published()->create([ 'slug' => 'casamento-jardim', ]); PortfolioImage::query()->create([ 'portfolio_case_id' => $published->id, 'path' => 'content/gallery.jpg', 'alt_text' => 'Galeria', 'caption' => null, 'sort_order' => 1, ]); PortfolioCase::factory()->create([ 'slug' => 'rascunho-interno', 'published_at' => null, ]); $found = (new FindPublishedPortfolioCaseBySlug)('casamento-jardim'); $draft = (new FindPublishedPortfolioCaseBySlug)('rascunho-interno'); $missing = (new FindPublishedPortfolioCaseBySlug)('inexistente'); $this->assertNotNull($found); $this->assertTrue($found->is($published)); $this->assertTrue($found->relationLoaded('images')); $this->assertCount(1, $found->images); $this->assertNull($draft); $this->assertNull($missing); } }