TenantAtlas/apps/platform/tests/Feature/Guards/NoActiveTenantResourceRoutesTest.php
Ahmed Darrazi 185f2795c6
Some checks failed
PR Fast Feedback / fast-feedback (pull_request) Failing after 1m45s
feat: retire legacy tenant route surfaces
2026-05-13 01:31:46 +02:00

33 lines
1.0 KiB
PHP

<?php
declare(strict_types=1);
use App\Support\Workspaces\WorkspaceContext;
use Illuminate\Support\Facades\Route;
it('does not register active /admin/tenants product routes', function (): void {
$legacyRouteUris = collect(Route::getRoutes())
->map(fn ($route): string => ltrim((string) $route->uri(), '/'))
->filter(fn (string $uri): bool => preg_match('#^admin/tenants(?:/|$)#', $uri) === 1)
->values();
expect($legacyRouteUris)->toBeEmpty();
});
it('returns 404 for retired TenantResource route shapes', function (): void {
[$user, $tenant] = createMinimalUserWithTenant(role: 'owner');
foreach ([
'/admin/tenants',
"/admin/tenants/{$tenant->external_id}",
"/admin/tenants/{$tenant->external_id}/edit",
"/admin/tenants/{$tenant->external_id}/memberships",
] as $path) {
$this->actingAs($user)
->withSession([WorkspaceContext::SESSION_KEY => (int) $tenant->workspace_id])
->get($path)
->assertNotFound();
}
});