Files
miniapi/tests/customer_center_action_dispatch_self_check.php
gaofeng e0aeff2af7 提交
2026-09-01 11:07:13 +08:00

26 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
$controller = file_get_contents(__DIR__ . '/../app/miniapi/controller/CustomerCenter.php');
if (!is_string($controller)) {
throw new RuntimeException('Unable to read customer center controller');
}
if (!str_contains($controller, "param('_action', '')")) {
throw new RuntimeException('Applicant endpoint must inspect the explicit action parameter');
}
if (!str_contains($controller, "\$action === 'save'")) {
throw new RuntimeException('Applicant endpoint must dispatch the save action');
}
if (!str_contains($controller, "\$action === 'remove'")) {
throw new RuntimeException('Applicant endpoint must dispatch the remove action');
}
foreach (['miniprogram', 'miniprogram-bj'] as $miniapp) {
$profiles = file_get_contents(__DIR__ . '/../../' . $miniapp . '/pages/profiles/index.js');
if (!is_string($profiles) || !str_contains($profiles, '/miniapi/customer-center/applicant?_action=remove')) {
throw new RuntimeException($miniapp . ' must call the explicit remove action');
}
}
echo "Customer center action dispatch self-check passed\n";