## Summary - hard-cut environment-owned CTA links into workspace hubs to canonical `environment_id` filters - add shared workspace-hub environment filter resolution and visible filtered-state rendering across in-scope hubs - update workspace hub pages, link helpers, and focused test coverage for explicit environment CTA filtering ## Validation - Not run in this workflow Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #370
61 lines
2.9 KiB
PHP
61 lines
2.9 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Support\Navigation\WorkspaceHubRegistry;
|
|
|
|
it('Spec314 lists workspace hubs and explicit exclusions', function (): void {
|
|
expect(array_keys(WorkspaceHubRegistry::entries()))
|
|
->toContain(
|
|
'workspace_home',
|
|
'workspace_overview',
|
|
'operations',
|
|
'provider_connections',
|
|
'finding_exceptions_queue',
|
|
'evidence_overview',
|
|
'review_register',
|
|
'customer_review_workspace',
|
|
'governance_inbox',
|
|
'decision_register',
|
|
'audit_log',
|
|
'alerts',
|
|
'alert_deliveries',
|
|
'alert_rules',
|
|
'alert_destinations',
|
|
'workspace_settings',
|
|
'manage_workspaces',
|
|
'managed_environments_landing',
|
|
)
|
|
->and(array_keys(WorkspaceHubRegistry::exclusions()))
|
|
->toContain(
|
|
'environment_dashboard',
|
|
'stored_reports_environment_routes',
|
|
'support_request_action_surface',
|
|
);
|
|
});
|
|
|
|
it('Spec314 classifies workspace hubs without classifying environment-owned pages', function (): void {
|
|
expect(WorkspaceHubRegistry::isWorkspaceHubPath('/admin'))->toBeTrue()
|
|
->and(WorkspaceHubRegistry::isWorkspaceHubPath('/admin/workspaces/1/overview'))->toBeTrue()
|
|
->and(WorkspaceHubRegistry::isWorkspaceHubPath('/admin/workspaces/1/operations'))->toBeTrue()
|
|
->and(WorkspaceHubRegistry::isWorkspaceHubPath('/admin/workspaces/1/environments'))->toBeTrue()
|
|
->and(WorkspaceHubRegistry::isWorkspaceHubPath('/admin/workspaces/1/environments/2'))->toBeFalse()
|
|
->and(WorkspaceHubRegistry::isExplicitlyExcludedPath('/admin/workspaces/1/environments/2'))->toBeTrue()
|
|
->and(WorkspaceHubRegistry::isWorkspaceHubPath('/admin/workspaces/1/environments/2/stored-reports'))->toBeFalse()
|
|
->and(WorkspaceHubRegistry::isExplicitlyExcludedPath('/admin/workspaces/1/environments/2/stored-reports'))->toBeTrue();
|
|
});
|
|
|
|
it('Spec314 owns forbidden query keys and environment-like filter keys', function (): void {
|
|
expect(WorkspaceHubRegistry::forbiddenQueryKeys())
|
|
->toBe(['tenant', 'tenant_id', 'managed_environment_id', 'environment_id', 'environment', 'tenant_scope', 'tableFilters'])
|
|
->and(WorkspaceHubRegistry::environmentLikeFilterKeys())
|
|
->toBe(['tenant', 'tenant_id', 'managed_environment_id', 'environment_id', 'environment', 'tenant_scope']);
|
|
});
|
|
|
|
it('Spec314 strips forbidden workspace hub query keys without touching unrelated navigation state', function (): void {
|
|
$url = WorkspaceHubRegistry::cleanUrl('/admin/provider-connections?tenant=a&tenant_id=1&managed_environment_id=2&environment_id=3&tenant_scope=all&tableFilters%5Btenant%5D=x&activeTab=failed&family=alerts');
|
|
|
|
expect($url)->toBe('/admin/provider-connections?activeTab=failed&family=alerts')
|
|
->and(WorkspaceHubRegistry::hasForbiddenQuery($url))->toBeFalse();
|
|
});
|