assertInstanceOf(ApiDocSampleSeeder::class, new ApiDocSampleService); } #[Test] public function 페이지_도메인_대표_샘플_맵을_반환한다(): void { $map = (new ApiDocSampleService)->seed(); $this->assertArrayHasKey('pages', $map); $this->assertSame(Page::class, $map['pages']['model']); $this->assertArrayHasKey('key', $map['pages']); $this->assertNotEmpty($map['pages']['value']); } #[Test] public function 대표_샘플_페이지는_발행_상태로_버전_이력과_첨부를_갖는다(): void { (new ApiDocSampleService)->seed(); $page = Page::query()->where('slug', 'apidoc-sample-page')->first(); $this->assertNotNull($page); $this->assertTrue($page->published); $this->assertNotNull($page->published_at); $this->assertNotNull($page->seo_meta); $this->assertSame(2, $page->versions()->count()); $this->assertSame(1, $page->attachments()->count()); } #[Test] public function 재실행_시_샘플이_중복_생성되지_않는다(): void { $service = new ApiDocSampleService; $service->seed(); $countAfterFirst = Page::query()->where('slug', 'apidoc-sample-page')->count(); $service->seed(); $countAfterSecond = Page::query()->where('slug', 'apidoc-sample-page')->count(); $this->assertSame(1, $countAfterFirst); $this->assertSame(1, $countAfterSecond); } }