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.
42 lines
1.9 KiB
PHTML
42 lines
1.9 KiB
PHTML
|
3 weeks ago
|
<?php
|
||
|
|
|
||
|
|
$root = dirname(__DIR__);
|
||
|
|
$assert = static function (bool $condition, string $message): void {
|
||
|
|
if (!$condition) {
|
||
|
|
throw new RuntimeException($message);
|
||
|
|
}
|
||
|
|
};
|
||
|
|
$read = static fn (string $path): string => (string) file_get_contents(
|
||
|
|
$root . '/' . $path
|
||
|
|
);
|
||
|
|
|
||
|
|
$pageService = $read('app/Services/Cloud/CloudInvoicePageService.php');
|
||
|
|
$invoiceService = $read('app/Services/Cloud/CloudInvoiceService.php');
|
||
|
|
$adminService = $read('app/Services/Cloud/CloudAdminBillingService.php');
|
||
|
|
$listTemplate = $read('resources/views/venix/cloud/pages/invoices.tpl');
|
||
|
|
$listRuntime = $read('public/cloud/invoices.js');
|
||
|
|
$detailRuntime = $read('public/cloud/invoice-detail-runtime.js');
|
||
|
|
$adminRuntime = $read('public/cloud/admin-billing.js');
|
||
|
|
|
||
|
|
$assert(str_contains($pageService, "'backup_addon'")
|
||
|
|
&& substr_count($invoiceService,
|
||
|
|
"'backup_addon' => '自动备份开通'") >= 2,
|
||
|
|
'Automatic-backup bills are not recognized by user invoice services.');
|
||
|
|
$assert(str_contains($listTemplate, 'value="backup_addon"')
|
||
|
|
&& str_contains($listRuntime, "value === 'backup_addon'")
|
||
|
|
&& str_contains($listRuntime, "backup_addon: '自动备份开通'")
|
||
|
|
&& str_contains($detailRuntime, "value === 'backup_addon'")
|
||
|
|
&& str_contains($detailRuntime, "backup_addon: '自动备份开通'")
|
||
|
|
&& str_contains($detailRuntime, "purpose === 'backup_addon'")
|
||
|
|
&& str_contains($detailRuntime, '/user/cloud/instances/'),
|
||
|
|
'User invoice UI hides the add-on type or its linked instance.');
|
||
|
|
$assert(str_contains($adminService,
|
||
|
|
"'provision', 'renewal', 'upgrade', 'ip_change', 'backup_addon', 'recharge'")
|
||
|
|
&& str_contains($adminRuntime,
|
||
|
|
"['backup_addon', '自动备份开通']")
|
||
|
|
&& str_contains($adminRuntime,
|
||
|
|
"backup_addon: '自动备份开通'"),
|
||
|
|
'Administrator billing filters or labels omit automatic-backup add-ons.');
|
||
|
|
|
||
|
|
echo "Automatic-backup invoice presentation contract passed.\n";
|