37 lines
971 B
PHP
37 lines
971 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use Presentation\Api\V1\Exceptions\ApiErrorCode;
|
|
|
|
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 = ApiErrorCode::NotFound;
|
|
|
|
// WHEN
|
|
$response = $test->get("/errors/{$code->value}");
|
|
|
|
// THEN
|
|
$response->assertStatus(200);
|
|
$response->assertSee('Resource Not Found');
|
|
$response->assertSee('not-found');
|
|
});
|
|
|
|
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);
|
|
});
|
|
});
|