This commit is contained in:
gaofeng
2026-09-01 14:55:59 +08:00
parent e0aeff2af7
commit a49b52a3e2
4 changed files with 80 additions and 3 deletions

View File

@@ -1,7 +1,7 @@
<?php
declare(strict_types=1);
$routes = file_get_contents(__DIR__ . '/../route/app.php');
$routes = file_get_contents(__DIR__ . '/../app/miniapi/route/app.php');
if (!is_string($routes)) {
throw new RuntimeException('Unable to read route configuration');
}

View File

@@ -32,12 +32,26 @@ miniCorrectionAssertSame(
'Authenticated user ID must override an untrusted client value'
);
$routes = file_get_contents(__DIR__ . '/../route/app.php');
$routeFile = __DIR__ . '/../app/miniapi/route/app.php';
$routes = is_file($routeFile) ? file_get_contents($routeFile) : false;
if (!is_string($routes)
|| !str_contains($routes, "Route::get('evus/correction', 'EvusCorrection/detail');")
|| !str_contains($routes, "Route::post('evus/correction/submit', 'EvusCorrection/submit');")
) {
throw new RuntimeException('The miniapi must register explicit correction detail and submit routes');
throw new RuntimeException('The miniapi app must register explicit correction detail and submit routes in its multi-app route directory');
}
if (str_contains($routes, "Route::group('miniapi'")) {
throw new RuntimeException('App-specific routes must not repeat the miniapi application prefix');
}
if (!str_contains($routes, "Route::pattern(['product_id' => '[A-Za-z0-9_-]+']);")
|| !str_contains($routes, "Route::group('app', function () {")
|| !str_contains($routes, "Route::get('bootstrap', 'AppCatalog/bootstrap');")
|| !str_contains($routes, "Route::get('visas/:product_id', 'AppCatalog/detail');")
) {
throw new RuntimeException('The existing app catalog routes must remain available');
}
if (is_file(__DIR__ . '/../route/app.php')) {
throw new RuntimeException('Multi-app routes must not remain in the ignored project-level route directory');
}
$upload = file_get_contents(__DIR__ . '/../app/miniapi/controller/Upload.php');