API: nicht-numerische Routen-IDs als 404 statt TypeError/500

Ein vergessener Postman-Platzhalter (PM_ID) lief als String in die
int-typisierten Controller-Parameter. Numerische where-Constraints auf
den v1- und /service-Gruppen; Legacy faellt in den 410-Catch-all.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Kevin Adametz 2026-07-10 15:20:01 +00:00
parent 00f67c4e54
commit de532feec2
3 changed files with 20 additions and 0 deletions

View file

@ -214,3 +214,17 @@ test('api submit records the declared ai grade as binding confirmation', functio
// Audit-Trail: der Submit protokolliert die Deklaration versioniert.
->and($fresh->aiDeclarations()->count())->toBe(1);
});
test('api routes respond 404 instead of 500 for non-numeric press release ids', function () {
/** @var TestCase $this */
$user = User::factory()->create();
Sanctum::actingAs($user, ['press-releases:write']);
// Vergessener Postman-Platzhalter wie „PM_ID" darf nicht als String in
// die int-typisierten Controller-Parameter laufen (TypeError/500).
$this->postJson('/api/v1/press-releases/PM_ID/submit', ['ai_text_declaration' => 'none'])
->assertNotFound();
$this->getJson('/api/v1/press-releases/PM_ID')
->assertNotFound();
});