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/BackendPruneBoundaryTest.php

71 lines
2.8 KiB
PHTML

<?php
// Source-only checks: no application boot, credentials, or database connection.
$root = dirname(__DIR__);
$assert = function ($condition, $message) {
if (!$condition) {
fwrite(STDERR, $message . PHP_EOL);
exit(1);
}
};
$source = function ($path) use ($root, $assert) {
$text = file_get_contents($root . '/' . $path);
$assert(is_string($text), 'Missing retained source: ' . $path);
return $text;
};
foreach ([
'app/Controllers/UserAiController.php',
'app/Controllers/CommunityController.php',
'app/Controllers/EdgeConfigApiController.php',
'app/Controllers/NodeNetworkApiController.php',
'app/Controllers/NodeAccessLogApiController.php',
'app/Controllers/NodeGeminiApiController.php',
'app/Controllers/PaidRegistrationController.php',
'app/Controllers/LinkController.php',
'app/Controllers/ConfController.php',
'app/Controllers/Admin/NodeController.php',
'app/Controllers/Admin/AppleAccountController.php',
'app/Services/AccountLifecycleService.php',
'app/Services/PackageDiscountService.php',
'app/Services/TransientDataCleanupService.php',
'app/Models/Node.php',
'app/Models/NodeBackend.php',
'app/Models/TelegramSession.php',
'app/Middleware/Api.php',
'apple-account-detector-go',
] as $retired) {
$assert(!file_exists($root . '/' . $retired), 'Retired backend module remains: ' . $retired);
}
foreach (['UsdtPaymentService', 'UsdtScannerService'] as $name) {
$text = $source('app/Services/Payment/' . $name . '.php');
$assert(!str_contains($text, 'PaidRegistration') && !str_contains($text, 'paid_registration'),
'Native USDT still dispatches retired paid registration: ' . $name);
$assert(str_contains($text, "'recharge'"), 'Native USDT recharge flow was removed: ' . $name);
}
$logSchema = $source('sql/user_log.sql');
preg_match_all('/(?:CREATE|ALTER) TABLE\s+`([^`]+)`/', $logSchema, $matches);
$tables = array_values(array_unique($matches[1]));
sort($tables);
$assert($tables === ['setting', 'site_security_events', 'site_visit_daily_stats', 'site_visit_events', 'user_email_log'],
'Log schema lost a retained table or still provisions retired backend modules.');
foreach ([
'app/Controllers/ApiController.php',
'app/Controllers/PasswordController.php',
'app/Services/Mail.php',
'app/Services/Mail/Smtp.php',
'app/Services/Auth/JwtToken.php',
'app/Services/Payment/YipayPaymentService.php',
'app/Services/Payment/PaytaroPaymentService.php',
'app/Services/Payment/RechargeCreditService.php',
] as $retained) {
$source($retained);
}
$assert(str_contains($source('app/Controllers/ApiController.php'), 'function createCaptch'),
'Captcha endpoint was removed with the retired node APIs.');
echo 'Retired backend boundaries and retained mail/auth/payment sources passed.' . PHP_EOL;