add tests batch 20

This commit is contained in:
root
2026-06-09 01:03:53 -04:00
parent 95efb9652e
commit 6be4875c5e
1502 changed files with 13797 additions and 11313 deletions
@@ -20,18 +20,17 @@ class ApiDeepValidationFailureContractTest extends FullSurfaceE2EContractCase
$status = $response->getStatusCode();
if ($status >= 500) {
$failures[] = "$method $uri crashed on $label hostile payload with $status: ".$response->getContent();
$failures[] = "$method $uri crashed on $label hostile payload with $status: " . $response->getContent();
continue;
}
if (! in_array($status, [200, 201, 202, 204, 302, 400, 401, 403, 404, 405, 409, 419, 422], true)) {
$failures[] = "$method $uri returned unexpected $status on $label hostile payload: ".$response->getContent();
$failures[] = "$method $uri returned unexpected $status on $label hostile payload: " . $response->getContent();
}
}
}
$this->assertSame([], $failures, "Hostile payloads must fail cleanly, not leak framework explosions:\n".implode("\n", $failures));
$this->assertSame([], $failures, "Hostile payloads must fail cleanly, not leak framework explosions:\n" . implode("\n", $failures));
}
public function test_required_field_validation_uses_machine_readable_error_shape_when_validation_fails(): void
@@ -48,18 +47,17 @@ class ApiDeepValidationFailureContractTest extends FullSurfaceE2EContractCase
}
if (! $this->isJsonString($response->getContent())) {
$failures[] = "$method $uri returned 422 but not JSON: ".$response->getContent();
$failures[] = "$method $uri returned 422 but not JSON: " . $response->getContent();
continue;
}
$json = $response->json();
if (! is_array($json) || (! array_key_exists('errors', $json) && ! array_key_exists('message', $json))) {
$failures[] = "$method $uri returned 422 without message/errors: ".$response->getContent();
$failures[] = "$method $uri returned 422 without message/errors: " . $response->getContent();
}
}
$this->assertSame([], $failures, "Validation errors must be usable by clients, not poetic prose:\n".implode("\n", $failures));
$this->assertSame([], $failures, "Validation errors must be usable by clients, not poetic prose:\n" . implode("\n", $failures));
}
/** @return list<LaravelRoute> */