Add guarded legacy route shims for Edge Gateway with corresponding unit tests

This commit is contained in:
Jeppe Bundgaard
2026-04-24 15:51:09 +02:00
parent 2258a609e6
commit ed13f7a8d4
4 changed files with 52 additions and 0 deletions
@@ -0,0 +1,11 @@
<?php
try {
if (!class_exists(\classes\edgegateway::class) || !(new \classes\edgegateway())->isEnabled()) {
return;
}
} catch (\Throwable $exception) {
return;
}
require_once __DIR__ . '/../modules/edgegateway/routes/edgeGatewayConfigRoute.php';
@@ -0,0 +1,11 @@
<?php
try {
if (!class_exists(\classes\edgegateway::class) || !(new \classes\edgegateway())->isEnabled()) {
return;
}
} catch (\Throwable $exception) {
return;
}
require_once __DIR__ . '/../modules/edgegateway/routes/edgeGatewaysRoute.php';
@@ -0,0 +1,11 @@
<?php
try {
if (!class_exists(\classes\edgegateway::class) || !(new \classes\edgegateway())->isEnabled()) {
return;
}
} catch (\Throwable $exception) {
return;
}
require_once __DIR__ . '/../modules/edgegateway/routes/moduleEdgeGatewayRoute.php';
@@ -0,0 +1,19 @@
<?php
it('keeps guarded legacy root shims for moved edge gateway routes', function (): void {
$routesDirectory = app_path() . DIRECTORY_SEPARATOR . 'routes' . DIRECTORY_SEPARATOR;
$legacyShims = [
'edgeGatewaysRoute.php',
'edgeGatewayConfigRoute.php',
'moduleEdgeGatewayRoute.php',
];
foreach ($legacyShims as $legacyShim) {
$shimSource = file_get_contents($routesDirectory . $legacyShim);
expect($shimSource)->not->toBeFalse();
expect($shimSource)->toContain('new \\classes\\edgegateway()');
expect($shimSource)->toContain('isEnabled()');
expect($shimSource)->toContain("modules/edgegateway/routes/{$legacyShim}");
}
});