TenantAtlas/apps/platform/tests/Unit/Tenants/AdminSurfaceScopeTest.php
ahmido ddf7c15c52 feat: enforce environment-owned baseline compare routing (#374)
## Summary
- move Baseline Compare onto the canonical workspace plus environment owned route instead of workspace-style access
- remove legacy environment query and remembered-context fallback paths from the affected Baseline Compare entry points and shell handling
- update related navigation, support links, and regression coverage for admin surface scope and managed environment route contracts
- add Spec 319 artifacts for the environment-owned surface routing and shell context contract

## Testing
- `cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/Filament/BaselineCompareEnvironmentRouteContractTest.php tests/Feature/Filament/BaselineCompareLandingAdminTenantParityTest.php tests/Feature/Filament/BaselineCompareLandingDuplicateNamesBannerTest.php tests/Feature/Filament/BaselineCompareLandingRbacLabelsTest.php tests/Feature/Filament/BaselineCompareLandingStartSurfaceTest.php tests/Feature/Filament/BaselineCompareLandingWhyNoFindingsTest.php tests/Feature/Filament/PanelNavigationSegregationTest.php tests/Feature/Guards/ManagedEnvironmentCanonicalRouteContractTest.php tests/Feature/Navigation/WorkspaceHubRegistryTest.php tests/Feature/Rbac/BaselineCompareMatrixAuthorizationTest.php tests/Feature/Rbac/DriftLandingUiEnforcementTest.php tests/Unit/Tenants/AdminSurfaceScopeTest.php`
- `cd apps/platform && ./vendor/bin/sail bin pint --dirty --format agent`

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #374
2026-05-16 20:45:39 +00:00

34 lines
2.4 KiB
PHP

<?php
declare(strict_types=1);
use App\Support\Navigation\AdminSurfaceScope;
use Illuminate\Foundation\Testing\RefreshDatabase;
uses(RefreshDatabase::class);
it('classifies in-scope admin routes into canonical page categories', function (string $path, AdminSurfaceScope $expected): void {
expect(AdminSurfaceScope::fromPath($path))->toBe($expected);
})->with([
'workspace overview' => ['/admin', AdminSurfaceScope::WorkspaceWideSurface],
'workspace chooser exception' => ['/admin/choose-workspace', AdminSurfaceScope::WorkspaceChooserException],
'tenant chooser' => ['/admin/choose-environment', AdminSurfaceScope::WorkspaceScoped],
'retired tenant resource detail' => ['/admin/tenants/tenant-123', AdminSurfaceScope::WorkspaceScoped],
'retired tenant panel route' => ['/admin/t/tenant-123', AdminSurfaceScope::WorkspaceScoped],
'workspace environment detail' => ['/admin/workspaces/acme/environments/tenant-123', AdminSurfaceScope::EnvironmentBound],
'baseline compare environment route' => ['/admin/workspaces/acme/environments/tenant-123/baseline-compare', AdminSurfaceScope::EnvironmentBound],
'tenant scoped evidence detail' => ['/admin/evidence/123', AdminSurfaceScope::EnvironmentScopedEvidence],
'evidence overview' => ['/admin/evidence/overview', AdminSurfaceScope::WorkspaceWideSurface],
'customer review workspace' => ['/admin/reviews/workspace', AdminSurfaceScope::WorkspaceWideSurface],
'review register' => ['/admin/reviews', AdminSurfaceScope::WorkspaceWideSurface],
'governance decisions' => ['/admin/governance/decisions', AdminSurfaceScope::WorkspaceWideSurface],
'alerts' => ['/admin/alerts', AdminSurfaceScope::WorkspaceWideSurface],
'provider connections' => ['/admin/provider-connections', AdminSurfaceScope::WorkspaceWideSurface],
'workspace home overview' => ['/admin/workspaces/acme/overview', AdminSurfaceScope::WorkspaceWideSurface],
'onboarding index' => ['/admin/onboarding', AdminSurfaceScope::OnboardingWorkflow],
'onboarding draft' => ['/admin/onboarding/42', AdminSurfaceScope::OnboardingWorkflow],
'operations index' => ['/admin/workspaces/acme/operations', AdminSurfaceScope::WorkspaceWideSurface],
'retired operation run detail' => ['/admin/operations/44', AdminSurfaceScope::WorkspaceScoped],
'operation run detail' => ['/admin/workspaces/acme/operations/44', AdminSurfaceScope::CanonicalWorkspaceRecordViewer],
]);