Files
miniapi/tests/customer_center_route_order_self_check.php
gaofeng a49b52a3e2 提交
2026-09-01 14:55:59 +08:00

23 lines
1001 B
PHP

<?php
declare(strict_types=1);
$routes = file_get_contents(__DIR__ . '/../app/miniapi/route/app.php');
if (!is_string($routes)) {
throw new RuntimeException('Unable to read route configuration');
}
$detail = strpos($routes, "Route::post('customer-center/applicant',");
$save = strpos($routes, "Route::post('customer-center/applicant/save',");
$remove = strpos($routes, "Route::post('customer-center/applicant/remove',");
if ($detail === false || $save === false || $remove === false) {
throw new RuntimeException('Customer center applicant routes are incomplete');
}
if ($save > $detail || $remove > $detail) {
throw new RuntimeException('Specific applicant routes must be registered before the detail route');
}
if (!preg_match("/Route::post\('customer-center\\/applicant',\s*'CustomerCenter\\/applicant'\)->completeMatch\(\);/", $routes)) {
throw new RuntimeException('Applicant detail route must use complete matching');
}
echo "Customer center route order self-check passed\n";