TenantAtlas/apps/platform/tests/Feature/Guards/NoAdHocTenantLifecycleChecksSpec143Test.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

33 lines
1.3 KiB
PHP

<?php
declare(strict_types=1);
it('avoids raw tenant lifecycle string checks in the spec 143 coordination seams', function (): void {
$files = [
base_path('app/Filament/Pages/ChooseEnvironment.php'),
base_path('app/Http/Controllers/SelectEnvironmentController.php'),
base_path('app/Support/Workspaces/WorkspaceContext.php'),
base_path('app/Support/OperateHub/OperateHubShell.php'),
base_path('app/Filament/Pages/Workspaces/ManagedEnvironmentsLanding.php'),
base_path('app/Filament/Resources/ManagedEnvironmentResource.php'),
base_path('app/Filament/Resources/ManagedEnvironmentResource/Pages/ViewManagedEnvironment.php'),
];
$forbiddenPatterns = [
'/where\(\s*[\'"]status[\'"]\s*,\s*[\'"](draft|onboarding|active|archived)[\'"]\s*\)/',
'/->status\s*===\s*[\'"](draft|onboarding|active|archived)[\'"]/',
'/status\s*=>\s*[\'"](draft|onboarding|active|archived)[\'"]/',
];
foreach ($files as $file) {
$contents = file_get_contents($file);
expect($contents)->not->toBeFalse();
foreach ($forbiddenPatterns as $pattern) {
expect((int) preg_match($pattern, (string) $contents))
->toBe(0, "Unexpected ad hoc lifecycle check in {$file}: {$pattern}");
}
}
});