- Implemented views for error codes 400, 404, 422, 429, 500, and 503. - Updated error handling to use numeric codes instead of enum. - Enhanced error messages and resolution steps for better user guidance.
35 lines
880 B
PHP
35 lines
880 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Feature;
|
|
|
|
describe('Error Documentation Pages', function (): void {
|
|
it('renders the succinct documentation view for valid error codes', function (): void {
|
|
// GIVEN
|
|
/** @var \Tests\TestCase $test */
|
|
$test = $this;
|
|
$code = 404;
|
|
|
|
// WHEN
|
|
$response = $test->get("/errors/{$code}");
|
|
|
|
// THEN
|
|
$response->assertStatus(200);
|
|
$response->assertSee('Not Found');
|
|
$response->assertSee('404');
|
|
});
|
|
|
|
it('returns a 404 for an invalid error code slug', function (): void {
|
|
// GIVEN
|
|
/** @var \Tests\TestCase $test */
|
|
$test = $this;
|
|
$invalidSlug = 'non-existing-error-code';
|
|
|
|
// WHEN
|
|
$response = $test->get("/errors/{$invalidSlug}");
|
|
|
|
// THEN
|
|
$response->assertStatus(404);
|
|
});
|
|
});
|