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

52 lines
2.0 KiB
PHP

<?php
declare(strict_types=1);
it('keeps targeted provider-state runtime paths free of legacy provider status fallbacks', function (): void {
$guardedFiles = [
'apps/platform/app/Models/ProviderConnection.php',
'apps/platform/app/Services/Providers/Contracts/HealthResult.php',
'apps/platform/app/Services/Providers/MicrosoftProviderHealthCheck.php',
'apps/platform/app/Services/Providers/ProviderConnectionMutationService.php',
'apps/platform/app/Services/Providers/ProviderConnectionResolver.php',
'apps/platform/app/Services/Providers/ProviderConnectionStateProjector.php',
'apps/platform/app/Jobs/ProviderConnectionHealthCheckJob.php',
'apps/platform/app/Filament/Resources/ProviderConnectionResource.php',
'apps/platform/app/Filament/Resources/ManagedEnvironmentResource.php',
'apps/platform/app/Filament/System/Pages/Directory/Tenants.php',
'apps/platform/app/Filament/System/Pages/Directory/ViewTenant.php',
'apps/platform/resources/views/filament/infolists/entries/provider-connection-state.blade.php',
'apps/platform/resources/views/filament/system/pages/directory/view-tenant.blade.php',
];
$forbiddenNeedles = [
'health_status',
'BadgeDomain::ProviderConnectionStatus',
'BadgeDomain::ProviderConnectionHealth',
'ProviderConnectionStatusBadge',
'ProviderConnectionHealthBadge',
"'status' => 'connected'",
"'status' => 'needs_consent'",
"'status' => 'disabled'",
"'status' => 'error'",
];
$violations = [];
foreach ($guardedFiles as $relativePath) {
$contents = file_get_contents(repo_path($relativePath));
expect($contents)->toBeString();
foreach ($forbiddenNeedles as $needle) {
if (! str_contains($contents, $needle)) {
continue;
}
$violations[] = sprintf('%s contains forbidden legacy provider-state marker "%s".', $relativePath, $needle);
}
}
expect($violations)->toBe([]);
});