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.
48 lines
1.9 KiB
PHP
48 lines
1.9 KiB
PHP
<?php
|
|
|
|
$root = dirname(__DIR__);
|
|
$template = file_get_contents($root . '/resources/views/venix/admin/ticket/index.tpl');
|
|
$controller = file_get_contents($root . '/app/Controllers/Admin/TicketController.php');
|
|
$userController = file_get_contents($root . '/app/Controllers/UserController.php');
|
|
$schema = file_get_contents($root . '/sql/ss.sql');
|
|
|
|
$assert = static function ($condition, string $message): void {
|
|
if (!$condition) {
|
|
throw new RuntimeException($message);
|
|
}
|
|
};
|
|
|
|
$assert(
|
|
!str_contains($template, "params.set('length', '500')"),
|
|
'The administrator ticket page must not preload a capped pseudo-complete queue.'
|
|
);
|
|
$assert(
|
|
str_contains($template, "params.set('start', String(page * pageSize))")
|
|
&& str_contains($template, "params.set('length', String(pageSize))")
|
|
&& str_contains($template, "params.set('search[value]', search.value.trim())"),
|
|
'The administrator ticket page must send real server-side paging and search parameters.'
|
|
);
|
|
$assert(
|
|
str_contains($template, 'recordsFiltered')
|
|
&& str_contains($template, 'ticketPagePrevious')
|
|
&& str_contains($template, 'ticketPageNext'),
|
|
'The administrator ticket page must project filtered totals into paging controls.'
|
|
);
|
|
$assert(
|
|
str_contains($controller, 'last_reply_at')
|
|
&& str_contains($controller, "'statusTotals'")
|
|
&& str_contains($controller, 'generate(false)'),
|
|
'The ticket API must expose recent activity and complete status totals.'
|
|
);
|
|
$assert(
|
|
str_contains($userController, 'last_activity_at')
|
|
&& str_contains($userController, 'orderByDesc'),
|
|
'The user ticket queue must use the same recent-activity ordering contract.'
|
|
);
|
|
$assert(
|
|
str_contains($schema, 'ticket_activity_root_datetime'),
|
|
'The ticket schema must index root/activity time for the recent-activity projection.'
|
|
);
|
|
|
|
echo "Administrator ticket queue contract passed.\n";
|