All checks were successful
Alinha a página Sobre à composição aprovada (hero, pilares, Michele, processo, portfólio, CTA), com foto da Michele via CMS e tokens Heritage Editorial. Co-authored-by: Cursor <cursoragent@cursor.com>
119 lines
4.3 KiB
PHP
119 lines
4.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Feature\PublicSite;
|
|
|
|
use App\Filament\Pages\ManageSiteSettings;
|
|
use App\Models\PortfolioCase;
|
|
use App\Models\SiteSetting;
|
|
use App\Models\User;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Illuminate\Http\UploadedFile;
|
|
use Illuminate\Support\Facades\Storage;
|
|
use Livewire\Livewire;
|
|
use Tests\TestCase;
|
|
|
|
class AboutPageContentTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_about_page_renders_mock_section_order_without_principles_list(): void
|
|
{
|
|
SiteSetting::instance()->update([
|
|
'about_summary' => 'Eventos que refletem propósito, conectam pessoas e criam memórias.',
|
|
'principles' => ['Princípio que não deve aparecer no sobre'],
|
|
]);
|
|
|
|
$this->get(route('about'))
|
|
->assertOk()
|
|
->assertSee('data-motion="page-open"', false)
|
|
->assertSee('Sobre nós')
|
|
->assertSee('Sobre a Amare')
|
|
->assertSee('Eventos que refletem propósito, conectam pessoas e criam memórias.')
|
|
->assertSee('Atendimento próximo')
|
|
->assertSee('Planejamento minucioso')
|
|
->assertSee('Execução tranquila')
|
|
->assertSee('id="michele"', false)
|
|
->assertSee('Conheça Michele')
|
|
->assertSee('Como trabalhamos')
|
|
->assertSee('Escuta e entendimento')
|
|
->assertSee('Portfólio em destaque')
|
|
->assertSee('Vamos criar algo inesquecível juntos?')
|
|
->assertDontSee('Princípio que não deve aparecer no sobre')
|
|
->assertDontSee('Personalização sem complicação desnecessária');
|
|
}
|
|
|
|
public function test_about_renders_founder_image_from_cms_when_configured(): void
|
|
{
|
|
SiteSetting::instance()->update([
|
|
'founder_image_path' => 'content/about/founder/michele.jpg',
|
|
'founder_image_alt' => 'Michele, da Amare',
|
|
]);
|
|
|
|
$this->get(route('about'))
|
|
->assertOk()
|
|
->assertSee('content/about/founder/michele.jpg', false)
|
|
->assertSee('Michele, da Amare')
|
|
->assertSee('data-about-founder', false);
|
|
}
|
|
|
|
public function test_about_omits_founder_image_request_when_unset(): void
|
|
{
|
|
SiteSetting::instance()->update([
|
|
'founder_image_path' => null,
|
|
'founder_image_alt' => null,
|
|
]);
|
|
|
|
$html = $this->get(route('about'))->assertOk()->getContent();
|
|
|
|
$this->assertStringContainsString('data-about-founder', $html);
|
|
$this->assertStringNotContainsString('content/about/founder/', $html);
|
|
$this->assertStringContainsString('data-founder-tonal', $html);
|
|
}
|
|
|
|
public function test_about_portfolio_links_featured_cases(): void
|
|
{
|
|
$case = PortfolioCase::factory()->published()->create([
|
|
'title' => 'Casamento Ana e Lucas',
|
|
'slug' => 'casamento-ana-lucas',
|
|
'is_featured' => true,
|
|
'cover_image_path' => 'content/cases/ana-lucas.jpg',
|
|
'cover_image_alt' => 'Cerimônia ao ar livre',
|
|
'sort_order' => 1,
|
|
]);
|
|
|
|
PortfolioCase::factory()->published()->create([
|
|
'title' => 'Caso não destacado',
|
|
'slug' => 'nao-destacado',
|
|
'is_featured' => false,
|
|
'cover_image_path' => 'content/cases/other.jpg',
|
|
'sort_order' => 2,
|
|
]);
|
|
|
|
$this->get(route('about'))
|
|
->assertOk()
|
|
->assertSee(route('portfolio.show', $case), false)
|
|
->assertSee('Cerimônia ao ar livre')
|
|
->assertDontSee(route('portfolio.show', 'nao-destacado'), false);
|
|
}
|
|
|
|
public function test_founder_image_upload_requires_alt_text(): void
|
|
{
|
|
Storage::fake('public');
|
|
$this->actingAs(User::factory()->admin()->create());
|
|
|
|
Livewire::test(ManageSiteSettings::class)
|
|
->set('data.founder_image_path', [UploadedFile::fake()->create('michele.jpg', 100, 'image/jpeg')])
|
|
->set('data.founder_image_alt', null)
|
|
->call('save')
|
|
->assertHasFormErrors(['founder_image_alt' => 'required']);
|
|
|
|
Livewire::test(ManageSiteSettings::class)
|
|
->set('data.founder_image_path', null)
|
|
->set('data.founder_image_alt', null)
|
|
->call('save')
|
|
->assertHasNoFormErrors();
|
|
}
|
|
}
|