TenantAtlas/apps/platform/tests/Feature/Guards/NoActiveTenantResourceRoutesTest.php
ahmido 292d555eac refactor: consolidate internal tenant model naming (#355)
## Summary
- consolidate internal platform naming from `Tenant` to `Environment` / `ManagedEnvironment` across models, controllers, services, and Filament resources
- rename environment-scoped UI surfaces such as dashboards, chooser flows, navigation, and related widgets to match the updated environment-first domain language
- align middleware, onboarding/review lifecycle services, jobs, and route/context controllers with the new environment-scoped architecture

## Validation
- not rerun as part of this commit/push/PR request

## Notes
- branch is 1 commit ahead of `platform-dev`
- main commit: `refactor: consolidate internal tenant model naming`

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #355
2026-05-14 11:13:28 +00:00

42 lines
1.5 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/(?:t|tenants)(?:/|$)#', $uri) === 1)
->values();
expect($legacyRouteUris)->toBeEmpty();
});
it('does not register active tenant resource route names', function (): void {
$legacyRouteNames = collect(Route::getRoutes())
->map(fn ($route): ?string => $route->getName())
->filter(fn (?string $name): bool => is_string($name) && str_starts_with($name, 'filament.admin.resources.tenants.'))
->values();
expect($legacyRouteNames)->toBeEmpty();
});
it('returns 404 for retired ManagedEnvironmentResource route shapes', function (): void {
[$user, $tenant] = createMinimalUserWithTenant(role: 'owner');
foreach ([
'/admin/t/'.$tenant->external_id,
'/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();
}
});