diff --git a/tests/Collections/CollectionTest.php b/tests/Collections/CollectionTest.php new file mode 100644 index 00000000..02bd3ef3 --- /dev/null +++ b/tests/Collections/CollectionTest.php @@ -0,0 +1,54 @@ + 'Blog', + 'handle' => 'blog', + 'settings' => [ + 'routes' => '/blog/{slug}', + 'slugs' => true, + 'dated' => true, + 'template' => 'blog', + 'default_status' => false, + ], + ]); + + $find = CollectionFacade::find('blog'); + + $this->assertTrue($model->is($find->model())); + $this->assertEquals('blog', $find->handle()); + $this->assertEquals('Blog', $find->title()); + $this->assertEquals('/blog/{slug}', $find->route('en')); + $this->assertTrue($find->requiresSlugs()); + $this->assertTrue($find->dated()); + $this->assertEquals('blog', $find->template()); + $this->assertFalse($find->defaultPublishState()); + } + + #[Test] + public function it_saves_to_collection_model() + { + $collection = (new Collection)->handle('test'); + + $this->assertDatabaseMissing('collections', ['handle' => 'test']); + + $collection->save(); + + $this->assertDatabaseHas('collections', ['handle' => 'test']); + } +}