TenantAtlas/apps/platform/tests/Feature/Guards/EnvironmentCopyNeutralizationGuardTest.php
ahmido aeef285d1d feat: implement spec 286 UI copy, IA & localization neutralization (#345)
## Summary

Implements feature branch `286-ui-copy-ia-localization-neutralization`.

This change set:
- aligns chooser, managed-environment landing, dashboard, shell, and workspace context copy to environment-first terminology
- neutralizes the bounded policy and baseline helper copy called out by Spec 286
- adds focused feature, guard, and browser coverage plus the complete Spec 286 artifact set
- records the discovered `Capture snapshot` modal issue as out-of-scope runtime debt in the Spec 286 close-out notes

## Validation

- `export PATH="/bin:/usr/bin:/usr/local/bin:$PATH" && cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/Localization/EnvironmentContextTerminologyTest.php tests/Feature/Filament/EnvironmentContextSurfaceCopyTest.php tests/Feature/Filament/Localization/PolicyInventoryLocalizationTest.php tests/Feature/Guards/EnvironmentCopyNeutralizationGuardTest.php`
- `export PATH="/bin:/usr/bin:/usr/local/bin:$PATH" && cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Browser/Spec286EnvironmentCopyNeutralizationSmokeTest.php`
- `export PATH="/bin:/usr/bin:/usr/local/bin:$PATH" && cd apps/platform && ./vendor/bin/sail bin pint --dirty --format agent`

## Notes

- Target branch: `platform-dev`
- Filament remains on v5 with Livewire v4.
- Provider registration remains unchanged in `apps/platform/bootstrap/providers.php`.
- No new destructive actions, asset strategy changes, or global-search posture changes are introduced in this slice.

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #345
2026-05-09 23:29:11 +00:00

86 lines
3.3 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/resources/views/filament/pages/baseline-compare-landing.blade.php' => [
'tenant landing',
],
'apps/platform/lang/en/localization.php' => [
'build this tenant\'s policy inventory',
],
'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.',
],
'apps/platform/app/Services/Tenants/TenantActionPolicySurface.php' => [
'Add 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');
});