You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
1.1 KiB
PHP
24 lines
1.1 KiB
PHP
<?php
|
|
|
|
$javascript = file_get_contents(dirname(__DIR__) . '/public/theme/venix/js/ticket-page.js');
|
|
$userController = file_get_contents(dirname(__DIR__) . '/app/Controllers/UserController.php');
|
|
$adminController = file_get_contents(dirname(__DIR__) . '/app/Controllers/Admin/TicketController.php');
|
|
|
|
$assert = static function ($condition, string $message): void {
|
|
if (!$condition) {
|
|
throw new RuntimeException($message);
|
|
}
|
|
};
|
|
|
|
$assert(str_contains($javascript, 'Idempotency-Key')
|
|
&& str_contains($javascript, 'requestFingerprint'),
|
|
'User ticket submissions do not retain a logical request key across retries.');
|
|
$assert(str_contains($javascript, 'if (!data.ret) done()')
|
|
|| str_contains($javascript, 'if (!data.ret) {') && str_contains($javascript, 'done();'),
|
|
'A successful ticket submission still re-enables its controls before navigation.');
|
|
$assert(str_contains($userController, "getHeaderLine('Idempotency-Key')")
|
|
&& str_contains($adminController, "getHeaderLine('Idempotency-Key')"),
|
|
'A ticket HTTP adapter does not pass the idempotency key into the write module.');
|
|
|
|
echo "Ticket page idempotency contract passed.\n";
|