for(Anime::factory()) ->createOne(); $type = $theme->type; $this->assertInstanceOf(ThemeType::class, $type); }); test('searchable as', function (): void { $theme = Theme::factory() ->for(Anime::factory()) ->createOne(); $this->assertIsString($theme->searchableAs()); }); test('to searchable array', function (): void { $theme = Theme::factory() ->for(Anime::factory()) ->createOne(); $this->assertIsArray($theme->toSearchableArray()); }); test('nameable', function (): void { $theme = Theme::factory() ->for(Anime::factory()) ->createOne(); $this->assertIsString($theme->getName()); }); test('has subtitle', function (): void { $theme = Theme::factory() ->for(Anime::factory()) ->createOne(); $this->assertIsString($theme->getSubtitle()); }); test('anime', function (): void { $theme = Theme::factory() ->for(Anime::factory()) ->createOne(); $this->assertInstanceOf(BelongsTo::class, $theme->anime()); $this->assertInstanceOf(Anime::class, $theme->anime()->first()); }); test('group', function (): void { $theme = Theme::factory() ->for(Anime::factory()) ->for(Group::factory()) ->createOne(); $this->assertInstanceOf(BelongsTo::class, $theme->group()); $this->assertInstanceOf(Group::class, $theme->group()->first()); }); test('song', function (): void { $theme = Theme::factory() ->for(Anime::factory()) ->for(Song::factory()) ->createOne(); $this->assertInstanceOf(BelongsTo::class, $theme->song()); $this->assertInstanceOf(Song::class, $theme->song()->first()); }); test('entries', function (): void { $entryCount = fake()->randomDigitNotNull(); $theme = Theme::factory() ->for(Anime::factory()) ->has(Entry::factory()->count($entryCount)) ->createOne(); $this->assertInstanceOf(HasMany::class, $theme->entries()); $this->assertEquals($entryCount, $theme->entries()->count()); $this->assertInstanceOf(Entry::class, $theme->entries()->first()); }); test('theme creates slug', function (): void { $theme = Theme::factory() ->for(Anime::factory()) ->createOne(); $this->assertArrayHasKey('slug', $theme); });