create(); $this->assertInstanceOf(Page::class, $page); $this->assertIsString($page->title); $this->assertIsString($page->slug); } /** @test */ public function it_has_correct_fillable_attributes(): void { $pageData = [ 'title' => 'About Us', 'slug' => 'about-us', 'content' => 'About us page content', 'meta' => [ 'description' => 'About us meta description', 'keywords' => 'about,company', ], 'is_published' => true, ]; $page = Page::query()->create($pageData); foreach ($pageData as $key => $value) { $this->assertEquals($value, $page->$key); } } /** @test */ public function it_generates_unique_slugs(): void { $page1 = Page::factory()->create(['title' => 'Same Title']); $page2 = Page::factory()->create(['title' => 'Same Title']); $this->assertNotEquals($page1->slug, $page2->slug); } /** @test */ public function it_can_query_published_pages(): void { Page::factory()->create(['is_published' => true]); Page::factory()->create(['is_published' => false]); $publishedPages = Page::query()->where('is_published', true)->get(); $draftPages = Page::query()->where('is_published', false)->get(); $this->assertCount(1, $publishedPages); $this->assertCount(1, $draftPages); } }