diff --git a/tests/Stache/FeatureTest.php b/tests/Stache/FeatureTest.php index 50dd1d81f4..d1d79e07fd 100644 --- a/tests/Stache/FeatureTest.php +++ b/tests/Stache/FeatureTest.php @@ -283,7 +283,7 @@ public function saving_an_entry_writes_it_to_file() ->data(['title' => 'Test Entry', 'foo' => 'bar']) )->save(); - $this->assertFileExists(__DIR__.'/__fixtures__/content/collections/blog/2017-07-04.test-entry.md'); + $this->assertFileExists(__DIR__.'/__fixtures__/content/collections/blog/2017-07-04-0000.test-entry.md'); $entry->delete(); } @@ -302,7 +302,7 @@ public function saving_an_entry_with_a_closure_based_slug_resolves_it_before_wri ->data(['title' => 'Test Entry', 'foo' => 'bar']) )->save(); - $this->assertFileExists(__DIR__.'/__fixtures__/content/collections/blog/2017-07-04.test-entry.md'); + $this->assertFileExists(__DIR__.'/__fixtures__/content/collections/blog/2017-07-04-0000.test-entry.md'); $entry->delete(); } diff --git a/tests/Stache/Repositories/EntryRepositoryTest.php b/tests/Stache/Repositories/EntryRepositoryTest.php index 965933fc68..1c50771fa1 100644 --- a/tests/Stache/Repositories/EntryRepositoryTest.php +++ b/tests/Stache/Repositories/EntryRepositoryTest.php @@ -202,7 +202,7 @@ public function it_saves_an_entry_to_the_stache_and_to_a_file() ->date('2017-07-04') ->data(['foo' => 'bar']); - $this->unlinkAfter($path = $this->directory.'/blog/2017-07-04.test.md'); + $this->unlinkAfter($path = $this->directory.'/blog/2017-07-04-0000.test.md'); $this->assertCount(14, $this->repo->all()); $this->assertNull($this->repo->find('test-blog-entry')); @@ -228,7 +228,7 @@ public function it_can_delete() ->date('2017-07-04') ->data(['foo' => 'bar']); - $this->unlinkAfter($path = $this->directory.'/blog/2017-07-04.test.md'); + $this->unlinkAfter($path = $this->directory.'/blog/2017-07-04-0000.test.md'); $this->assertCount(14, $this->repo->all()); $this->assertNull($this->repo->find('test-blog-entry')); diff --git a/tests/Stache/Stores/EntriesStoreTest.php b/tests/Stache/Stores/EntriesStoreTest.php index 0d2f241e1c..5f67124df4 100644 --- a/tests/Stache/Stores/EntriesStoreTest.php +++ b/tests/Stache/Stores/EntriesStoreTest.php @@ -53,8 +53,8 @@ public function it_gets_nested_files() $files = Traverser::filter([$store, 'getItemFilter'])->traverse($store); $this->assertEquals(collect([ - $dir.'/blog/2017-25-12.christmas.md', - $dir.'/blog/2018-07-04.fourth-of-july.md', + $dir.'/blog/2017-25-12-0000.christmas.md', + $dir.'/blog/2018-07-04-0000.fourth-of-july.md', ])->sort()->values()->all(), $files->keys()->sort()->values()->all()); }); @@ -175,7 +175,7 @@ public function it_saves_to_disk() $this->parent->store('blog')->save($entry); - $this->assertStringEqualsFile($path = $this->directory.'/blog/2017-07-04.test.md', $entry->fileContents()); + $this->assertStringEqualsFile($path = $this->directory.'/blog/2017-07-04-0000.test.md', $entry->fileContents()); @unlink($path); $this->assertFileDoesNotExist($path); @@ -193,13 +193,13 @@ public function it_saves_to_disk_with_modified_path() $this->parent->store('blog')->save($entry); - $this->assertStringEqualsFile($initialPath = $this->directory.'/blog/2017-07-04.test.md', $entry->fileContents()); + $this->assertStringEqualsFile($initialPath = $this->directory.'/blog/2017-07-04-0000.test.md', $entry->fileContents()); $this->assertEquals($initialPath, $this->parent->store('blog')->paths()->get('123')); $entry->slug('updated'); $entry->save(); - $this->assertStringEqualsFile($path = $this->directory.'/blog/2017-07-04.updated.md', $entry->fileContents()); + $this->assertStringEqualsFile($path = $this->directory.'/blog/2017-07-04-0000.updated.md', $entry->fileContents()); $this->assertEquals($path, $this->parent->store('blog')->paths()->get('123')); @unlink($initialPath); @@ -209,18 +209,18 @@ public function it_saves_to_disk_with_modified_path() #[Test] public function it_appends_suffix_to_the_filename_if_one_already_exists() { - $existingPath = $this->directory.'/blog/2017-07-04.test.md'; + $existingPath = $this->directory.'/blog/2017-07-04-0000.test.md'; file_put_contents($existingPath, $existingContents = "---\nid: existing-id\n---"); $entry = Facades\Entry::make()->id('new-id')->slug('test')->collection('blog')->date('2017-07-04'); $this->parent->store('blog')->save($entry); - $newPath = $this->directory.'/blog/2017-07-04.test.1.md'; + $newPath = $this->directory.'/blog/2017-07-04-0000.test.1.md'; $this->assertStringEqualsFile($existingPath, $existingContents); $this->assertStringEqualsFile($newPath, $entry->fileContents()); $anotherEntry = Facades\Entry::make()->id('another-new-id')->slug('test')->collection('blog')->date('2017-07-04'); $this->parent->store('blog')->save($anotherEntry); - $anotherNewPath = $this->directory.'/blog/2017-07-04.test.2.md'; + $anotherNewPath = $this->directory.'/blog/2017-07-04-0000.test.2.md'; $this->assertStringEqualsFile($existingPath, $existingContents); $this->assertStringEqualsFile($anotherNewPath, $anotherEntry->fileContents()); @@ -238,7 +238,7 @@ public function it_appends_suffix_to_the_filename_if_one_already_exists() #[Test] public function it_doesnt_append_the_suffix_to_the_filename_if_it_is_itself() { - $existingPath = $this->directory.'/blog/2017-07-04.test.md'; + $existingPath = $this->directory.'/blog/2017-07-04-0000.test.md'; file_put_contents($existingPath, "---\nid: the-id\n---"); $entry = Facades\Entry::make() @@ -249,7 +249,7 @@ public function it_doesnt_append_the_suffix_to_the_filename_if_it_is_itself() $this->parent->store('blog')->save($entry); - $pathWithSuffix = $this->directory.'/blog/2017-07-04.test.1.md'; + $pathWithSuffix = $this->directory.'/blog/2017-07-04-0000.test.1.md'; $this->assertStringEqualsFile($existingPath, $entry->fileContents()); $this->assertEquals($existingPath, $this->parent->store('blog')->paths()->get('the-id')); @@ -261,9 +261,9 @@ public function it_doesnt_append_the_suffix_to_the_filename_if_it_is_itself() #[Test] public function it_doesnt_append_the_suffix_to_an_already_suffixed_filename_if_it_is_itself() { - $suffixlessExistingPath = $this->directory.'/blog/2017-07-04.test.md'; + $suffixlessExistingPath = $this->directory.'/blog/2017-07-04-0000.test.md'; file_put_contents($suffixlessExistingPath, "---\nid: the-id\n---"); - $suffixedExistingPath = $this->directory.'/blog/2017-07-04.test.md'; + $suffixedExistingPath = $this->directory.'/blog/2017-07-04-0000.test.md'; file_put_contents($suffixedExistingPath, "---\nid: another-id\n---"); $entry = Facades\Entry::make() @@ -274,7 +274,7 @@ public function it_doesnt_append_the_suffix_to_an_already_suffixed_filename_if_i $this->parent->store('blog')->save($entry); - $pathWithIncrementedSuffix = $this->directory.'/blog/2017-07-04.test.2.md'; + $pathWithIncrementedSuffix = $this->directory.'/blog/2017-07-04-0000.test.2.md'; $this->assertStringEqualsFile($suffixedExistingPath, $entry->fileContents()); @unlink($suffixedExistingPath); $this->assertFileDoesNotExist($pathWithIncrementedSuffix); @@ -286,8 +286,8 @@ public function it_doesnt_append_the_suffix_to_an_already_suffixed_filename_if_i #[Test] public function it_keeps_the_suffix_even_if_the_suffixless_path_is_available() { - $existingPath = $this->directory.'/blog/2017-07-04.test.1.md'; - $suffixlessPath = $this->directory.'/blog/2017-07-04.test.md'; + $existingPath = $this->directory.'/blog/2017-07-04-0000.test.1.md'; + $suffixlessPath = $this->directory.'/blog/2017-07-04-0000.test.md'; file_put_contents($existingPath, 'id: 123'); $entry = $this->parent->store('blog')->makeItemFromFile($existingPath, file_get_contents($existingPath)); @@ -309,8 +309,8 @@ public function it_removes_the_suffix_if_it_previously_had_one_but_needs_a_new_p // eg. if the slug is changing, and the filename would be changing anyway, // we shouldn't maintain the suffix. - $existingPath = $this->directory.'/blog/2017-07-04.test.1.md'; - $newPath = $this->directory.'/blog/2017-07-04.updated.md'; + $existingPath = $this->directory.'/blog/2017-07-04-0000.test.1.md'; + $newPath = $this->directory.'/blog/2017-07-04-0000.updated.md'; file_put_contents($existingPath, 'id: 123'); $entry = $this->parent->store('blog')->makeItemFromFile($existingPath, file_get_contents($existingPath)); diff --git a/tests/Stache/__fixtures__/content/collections/blog/2017-25-12.christmas.md b/tests/Stache/__fixtures__/content/collections/blog/2017-25-12-0000.christmas.md similarity index 100% rename from tests/Stache/__fixtures__/content/collections/blog/2017-25-12.christmas.md rename to tests/Stache/__fixtures__/content/collections/blog/2017-25-12-0000.christmas.md diff --git a/tests/Stache/__fixtures__/content/collections/blog/2018-07-04.fourth-of-july.md b/tests/Stache/__fixtures__/content/collections/blog/2018-07-04-0000.fourth-of-july.md similarity index 100% rename from tests/Stache/__fixtures__/content/collections/blog/2018-07-04.fourth-of-july.md rename to tests/Stache/__fixtures__/content/collections/blog/2018-07-04-0000.fourth-of-july.md