23 lines
1001 B
PHP
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";
|