TenantAtlas/apps/platform/tests/Feature/Guards/EnvironmentCopyNeutralizationGuardTest.php
ahmido 5722c4f051 feat: clean up managed environment terminology copy (#353)
## Summary
- replace tenant-first operator copy with environment and managed environment terminology across Filament pages, resources, services, Blade views, and localization
- align baseline compare, findings, governance, monitoring, backup schedule, and required-permissions surfaces with the managed-environment vocabulary
- update guard, feature, and browser smoke coverage and add the Spec 298 audit artifacts documenting allowed provider, internal, and regression-guard tenant references

## Validation
- cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/Guards
- cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/Localization
- cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/Workspaces
- cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/ProviderConnections
- cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/RequiredPermissions
- cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Browser/Spec190BaselineCompareMatrixSmokeTest.php tests/Browser/Spec281ProviderConnectionScopeSmokeTest.php tests/Browser/Spec285WorkspaceRbacEnvironmentAccessSmokeTest.php tests/Browser/Dashboard/TenantDashboardProductizationSmokeTest.php
- cd apps/platform && ./vendor/bin/sail bin pint --dirty --format agent

## Notes
- Filament remains on Livewire v4.
- No panel provider or asset-strategy changes are included in this branch.
- Existing destructive actions retain their confirmation and authorization behavior.

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #353
2026-05-13 09:34:08 +00:00

149 lines
5.9 KiB
PHP

<?php
declare(strict_types=1);
use Illuminate\Support\Facades\App;
it('keeps in-scope surfaces free of retired tenant-first and provider-first copy', function (): void {
$forbiddenCopyByFile = [
'apps/platform/app/Filament/Pages/ChooseTenant.php' => [
'Choose tenant',
],
'apps/platform/resources/views/filament/pages/choose-tenant.blade.php' => [
'Choose tenant',
'Select the tenant for your normal active operating context.',
'No tenant selected is still a valid workspace state',
'No active tenants available',
'View managed tenants',
'Add tenant',
],
'apps/platform/app/Filament/Pages/Workspaces/ManagedTenantsLanding.php' => [
'Managed tenants',
],
'apps/platform/resources/views/filament/pages/workspaces/managed-tenants-landing.blade.php' => [
'No managed tenants yet',
'Choose tenant',
'Add tenant',
'Connect your first Microsoft Entra tenant',
],
'apps/platform/resources/views/filament/partials/context-bar.blade.php' => [
'Tenant scope',
'Select tenant',
'Selected tenant',
'Switch tenant',
'Clear tenant scope',
'No active tenants',
'View managed tenants',
'Search tenants',
],
'apps/platform/app/Support/OperateHub/OperateHubShell.php' => [
'ManagedEnvironment scope',
'All tenants',
],
'apps/platform/app/Filament/Pages/Monitoring/Operations.php' => [
'Show all tenants',
'one tenant inside the active workspace',
'all entitled tenants',
'tenant-specific context',
],
'apps/platform/app/Filament/Pages/Monitoring/FindingExceptionsQueue.php' => [
'View tenant register',
'Open tenant detail',
],
'apps/platform/app/Filament/Pages/Findings/MyFindingsInbox.php' => [
'Clear tenant filter',
'No assigned findings match this tenant scope',
'Open tenant findings',
'Choose a tenant',
],
'apps/platform/app/Filament/Resources/BackupScheduleResource.php' => [
'No tenant selected',
],
'apps/platform/app/Filament/Resources/BaselineProfileResource/RelationManagers/BaselineTenantAssignmentsRelationManager.php' => [
'Remove tenant assignment',
'No tenants assigned',
],
'apps/platform/resources/views/filament/pages/baseline-compare-landing.blade.php' => [
'tenant landing',
],
'apps/platform/resources/views/filament/pages/baseline-compare-matrix.blade.php' => [
'Open tenant compare',
'Visible tenants',
'Assigned tenants',
'Compact unlocks at one visible tenant',
'Dense multi-tenant scan',
'No assigned tenants',
'No visible assigned tenants',
],
'apps/platform/app/Filament/Pages/BaselineCompareMatrix.php' => [
'Compare assigned tenants',
'tenant-owned baseline compare',
'comparing assigned tenants',
'No visible assigned tenants',
'visible tenant before compare',
],
'apps/platform/app/Filament/Resources/BaselineProfileResource/Pages/ViewBaselineProfile.php' => [
'Compare assigned tenants',
'tenant-owned baseline compare',
'comparing assigned tenants',
'No visible assigned tenants',
],
'apps/platform/app/Support/ReasonTranslation/ReasonTranslator.php' => [
'assigned tenant with compare',
'access to an assigned tenant',
],
'apps/platform/resources/views/filament/pages/monitoring/finding-exceptions-queue.blade.php' => [
'Open tenant detail',
'tenant drilldowns',
],
'apps/platform/resources/views/filament/pages/tenant-required-permissions.blade.php' => [
'No tenant selected',
],
'apps/platform/lang/en/localization.php' => [
'build this tenant\'s policy inventory',
'Tenant scope',
'Select tenant',
'No tenant selected',
'No active tenants',
'Tenant dashboard',
'tenant blocker',
],
'apps/platform/app/Support/Baselines/BaselineCompareSummaryAssessor.php' => [
'This tenant does not have an assigned baseline yet.',
],
'apps/platform/app/Support/Baselines/BaselineCompareStats.php' => [
'This tenant has no baseline assignment. A workspace manager can assign a baseline profile to this tenant.',
'No tenant selected.',
],
'apps/platform/app/Services/Tenants/TenantActionPolicySurface.php' => [
'Add tenant',
'Restore tenant',
'Archive tenant',
],
'apps/platform/app/Support/Ui/GovernanceActions/GovernanceActionCatalog.php' => [
'Restore tenant',
'Archive tenant',
],
];
foreach ($forbiddenCopyByFile as $relativePath => $forbiddenStrings) {
$absolutePath = repo_path($relativePath);
expect(is_file($absolutePath))->toBeTrue("Expected file [{$relativePath}] to exist for the copy guard.");
$contents = (string) file_get_contents($absolutePath);
foreach ($forbiddenStrings as $forbiddenString) {
expect($contents)
->not->toContain($forbiddenString, "Found retired copy [{$forbiddenString}] in [{$relativePath}].");
}
}
});
it('keeps auth-provider wording explicitly Microsoft-owned', function (): void {
App::setLocale('en');
expect(__('localization.auth.sign_in_microsoft'))->toBe('Sign in with Microsoft')
->and(__('localization.policy.common.source_microsoft_intune'))->toBe('Source: Microsoft Intune');
});