create(['published_at' => null]); $published = Testimonial::factory()->published()->create(); $this->assertCount(1, Testimonial::query()->published()->get()); $this->assertTrue(Testimonial::query()->published()->first()?->is($published)); } public function test_featured_testimonials_are_filterable(): void { Testimonial::factory()->create(['is_featured' => false]); $featured = Testimonial::factory()->featured()->create(); $results = Testimonial::query()->where('is_featured', true)->get(); $this->assertCount(1, $results); $this->assertTrue($results->first()?->is($featured)); } public function test_assistant_cannot_access_testimonials_resource(): void { $assistant = User::factory()->assistant()->create(); $this->actingAs($assistant); Livewire::test(ListTestimonials::class) ->assertForbidden(); } public function test_content_seeder_loads_five_real_couples_from_depoimentos(): void { Storage::fake('public'); $this->seed(ContentSeeder::class); $authors = Testimonial::query()->orderBy('sort_order')->pluck('author_name')->all(); $this->assertSame([ 'Jeniffer e Maick', 'Quesia e Jhonata', 'Milena e Weslley', 'Raquel e Pedro', 'Victoria e Pedro', ], $authors); $this->assertNull( Testimonial::query()->where('author_name', 'Ana Souza')->first(), 'Fictional demo authors must not remain after seeding real testimonials.', ); $jeniffer = Testimonial::query()->where('author_name', 'Jeniffer e Maick')->first(); $this->assertNotNull($jeniffer); $this->assertStringContainsString('Mi, quero agradecer', (string) $jeniffer->quote); $this->assertStringContainsString("\n\n", (string) $jeniffer->quote); $this->assertSame('Casamento · 06/12/2025', $jeniffer->context); } public function test_home_renders_multi_paragraph_testimonial_quotes(): void { SiteSetting::instance(); Testimonial::factory()->published()->featured()->create([ 'quote' => "Primeiro parágrafo do depoimento.\n\nSegundo parágrafo com continuidade.", 'author_name' => 'Casal Exemplo', 'context' => 'Casamento · 01/01/2026', ]); $response = $this->get(route('home')); $response->assertOk(); $response->assertSee('Primeiro parágrafo do depoimento.', false); $response->assertSee('Segundo parágrafo com continuidade.', false); $response->assertDontSee( 'Primeiro parágrafo do depoimento. Segundo parágrafo com continuidade.', false, ); } }