Files
amare/tests/Feature/PublicSite/ErrorPagesTest.php
Manoel Freitas 2fe262ab59 Hardening public blades: overflow, fallbacks, branded errors, JS robustness (#14)
* fix: prevent long strings from overflowing public layout

* fix: fall back to default hero copy and tighten hero line-height

* fix: skip blank testimonials and guard empty portfolio metadata

* feat: add branded 419, 429 and 503 error pages

* fix: reset submit state on bfcache restore, swap label while sending, trap mobile menu focus

* chore: track hardening task status

* fix: restore contact submit state after bfcache

* fix: allow contact links to wrap long unbroken strings
2026-08-06 00:22:53 -03:00

60 lines
1.6 KiB
PHP

<?php
declare(strict_types=1);
namespace Tests\Feature\PublicSite;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Route;
use Tests\TestCase;
class ErrorPagesTest extends TestCase
{
use RefreshDatabase;
public function test_419_renders_branded_session_expired_page(): void
{
Route::get('/__test-419', fn (): never => abort(419));
$this->get('/__test-419')
->assertStatus(419)
->assertSee('Erro 419')
->assertSee('Sessão expirada')
->assertSee('Voltar para a home');
}
public function test_429_renders_branded_rate_limited_page(): void
{
Route::get('/__test-429', fn (): never => abort(429));
$this->get('/__test-429')
->assertStatus(429)
->assertSee('Erro 429')
->assertSee('Muitas solicitações')
->assertSee('Voltar para a home');
}
public function test_503_renders_branded_maintenance_page(): void
{
Route::get('/__test-503', fn (): never => abort(503));
$this->get('/__test-503')
->assertStatus(503)
->assertSee('Erro 503')
->assertSee('Em manutenção')
->assertSee('Voltar para a home');
}
public function test_error_pages_never_leak_debug_stack_traces(): void
{
config(['app.debug' => false]);
Route::get('/__test-503', fn (): never => abort(503));
$this->get('/__test-503')
->assertStatus(503)
->assertDontSee('segredo-interno-amare')
->assertDontSee('Exception');
}
}