Files
amare/tests/Feature/Marketing/TestimonialsTest.php
Manoel Freitas cf1589c916 feat: recreate public frontend with Heritage Editorial identity (#5)
* feat: recreate public frontend with Heritage Editorial identity

Replace placeholder visual system with EB Garamond/olive tokens, brand assets, editorial home narrative, São Paulo settings, real testimonials, and regenerated visual baselines.

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs: archive recreate-public-frontend and sync Heritage Editorial specs

Merge delta requirements into main OpenSpec capabilities and move the completed change into the dated archive.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-01 23:39:00 -03:00

101 lines
3.3 KiB
PHP

<?php
declare(strict_types=1);
namespace Tests\Feature\Marketing;
use App\Filament\Resources\Testimonials\Pages\ListTestimonials;
use App\Models\SiteSetting;
use App\Models\Testimonial;
use App\Models\User;
use Database\Seeders\ContentSeeder;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Storage;
use Livewire\Livewire;
use Tests\TestCase;
class TestimonialsTest extends TestCase
{
use RefreshDatabase;
public function test_published_scope_excludes_unpublished_testimonials(): void
{
Testimonial::factory()->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,
);
}
}