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.
virt/web/tests/FrontendResidueCleanupTest.php

87 lines
4.3 KiB
PHP

<?php
$root = dirname(__DIR__);
$read = static function (string $path): string {
$contents = file_get_contents($path);
if (!is_string($contents)) {
throw new RuntimeException('Unable to read ' . $path);
}
return $contents;
};
$assert = static function (bool $condition, string $message): void {
if (!$condition) {
throw new RuntimeException($message);
}
};
$views = $root . '/resources/views/venix/user';
$userScript = $read($root . '/public/theme/venix/js/user-home.js');
$accountCss = $read($root . '/public/cloud/account.css');
$clientCss = $read($root . '/public/cloud/client.css');
$adminCss = $read($root . '/public/theme/venix/css/admin-home.css');
$adminTicketCss = $read($root . '/public/theme/venix/css/admin-ticket.css');
$assert(!is_file($root . '/public/theme/venix/css/user-home.css'),
'The retired user-home stylesheet must not remain in the release.');
$assert(!is_file($views . '/layout_modal.tpl') && is_file($views . '/layout_toast.tpl'),
'The retired modal partial must be replaced by the Toast-only partial.');
foreach (['edit.tpl', 'paytaro.tpl', 'ticket_view.tpl', 'ticket_create.tpl', 'invite.tpl'] as $template) {
$source = $read($views . '/' . $template);
$assert(str_contains($source, "file='user/layout_toast.tpl'")
&& !str_contains($source, 'layout_modal.tpl'),
'User template does not use the Toast-only partial: ' . $template);
}
foreach (['modalState', 'function closeModal', 'function bindModalActions',
'function bindNotificationMenu', '.vu-notification', 'data-notify-toggle'] as $retiredToken) {
$assert(!str_contains($userScript, $retiredToken),
'Retired modal or notification runtime remains: ' . $retiredToken);
}
$assert(str_contains($userScript, 'window.VuModal = {')
&& str_contains($userScript, 'return showToast(config);'),
'The compatible VuModal API must continue to dispatch Toast messages.');
foreach (['.vu-notification', '.vu-notify-menu', '.vu-modal-actions',
'.vu-modal-backdrop', '.vu-modal-panel', '.vu-modal-card'] as $retiredSelector) {
$assert(!str_contains($accountCss, $retiredSelector),
'Retired account selector remains: ' . $retiredSelector);
}
$assert(str_contains($accountCss, 'body.vu-body .vu-pay-dialog')
&& str_contains($accountCss, 'body.vu-body .vu-modal-close')
&& str_contains($accountCss, 'body.vu-body .vu-modal-mark')
&& str_contains($accountCss, 'body.vu-body.vu-modal-lock'),
'The active payment dialog styles or body scroll lock were removed.');
$assert(!str_contains($accountCss, '.vu-compact-hint.vu-referral-hint'),
'The referral hint still relies on a duplicate specificity override.');
foreach (['.vu-ticket-actions', '.vu-ticket-grid', '.vu-support-message-content',
'.vu-support-meta', '.vu-ticket-tag.is-urgent', '.vu-stat {', '.vu-stat-grid',
'.vu-stats', '.vu-home-grid', '.vu-form,',
'.vu-form-row', '.vu-field'] as $retiredSelector) {
$assert(!str_contains($accountCss, $retiredSelector),
'Retired user or ticket selector remains: ' . $retiredSelector);
}
$assert(!str_contains($clientCss, 'width: min(720px, 100%)')
&& preg_match('/\.panel-account-drawer\s*\{[^}]*width:\s*min\(540px,\s*100%\)/s', $clientCss) === 1,
'The account drawer still has conflicting width declarations.');
$assert(!str_contains($clientCss, '.panel-account-drawer-kicker')
&& str_contains($clientCss, '#panel-account-drawer-description { display: none; }'),
'The compact account header still carries its retired kicker style.');
foreach (['.admin-ticket-avatar img', '.admin-ticket-content p:last-child'] as $retiredSelector) {
$assert(!str_contains($adminTicketCss, $retiredSelector),
'Retired administrator ticket selector remains: ' . $retiredSelector);
}
foreach (['.admin-ticket-tabs a[aria-disabled="true"]', '.admin-user-create {',
'.admin-user-main', '.admin-user-meta',
'.admin-user-actions-cell'] as $retiredSelector) {
$assert(!str_contains($adminCss, $retiredSelector),
'Retired administrator selector remains: ' . $retiredSelector);
}
$assert(str_contains($adminTicketCss, '.admin-ticket-avatar {')
&& str_contains($adminCss, '.admin-user-create-inline {'),
'An active administrator component was removed with the dead selectors.');
echo "Frontend residue cleanup checks passed.\n";