All checks were successful
Co-authored-by: Cursor <cursoragent@cursor.com>
146 lines
5.6 KiB
PHP
146 lines
5.6 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_layout_matches_site_editorial_rhythm(): void
|
|
{
|
|
SiteSetting::instance()->update([
|
|
'about_image_path' => 'content/heroes/about.jpg',
|
|
'about_image_alt' => 'Estúdio Amare',
|
|
]);
|
|
|
|
$html = $this->get(route('about'))->assertOk()->getContent();
|
|
|
|
$this->assertMatchesRegularExpression(
|
|
'/data-about-hero[\s\S]*?lg:grid-cols-12[\s\S]*?lg:col-span-5[\s\S]*?text-hero-spread[\s\S]*?lg:col-span-7/',
|
|
$html,
|
|
);
|
|
$this->assertStringNotContainsString('data-photo-hero', $html);
|
|
$this->assertDoesNotMatchRegularExpression(
|
|
'/data-about-hero[\s\S]*?min-h-\[calc\(100dvh-5rem\)\]/',
|
|
$html,
|
|
);
|
|
|
|
$this->assertMatchesRegularExpression('/data-about-pillars[\s\S]*?py-16 md:py-24/', $html);
|
|
$this->assertMatchesRegularExpression('/data-about-process[\s\S]*?py-16 md:py-24/', $html);
|
|
$this->assertMatchesRegularExpression('/data-about-portfolio[\s\S]*?data-editorial-portfolio/', $html);
|
|
$this->assertDoesNotMatchRegularExpression('/data-about-portfolio[\s\S]*?rounded-full/', $html);
|
|
$this->assertMatchesRegularExpression('/<(?:section)[^>]*(?:data-about-cta[^>]*bg-amare-bg-deep|bg-amare-bg-deep[^>]*data-about-cta)/', $html);
|
|
$this->assertStringContainsString('Próximo passo', $html);
|
|
}
|
|
|
|
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();
|
|
}
|
|
}
|