TenantAtlas/tests/Feature/Filament/PolicyVersionResolvedReferenceLinksTest.php
ahmido cc93329672 feat: canonical tenant context resolution (#164)
## Summary
- introduce a canonical admin tenant filter-state helper and route all in-scope workspace-admin tenant resolution through `OperateHubShell::activeEntitledTenant()`
- align operations monitoring, operation-run deep links, Entra group admin list/view/search behavior, and shared context-bar rendering with the documented scope contract
- add the Spec 135 design artifacts, architecture note, focused guardrail coverage, and non-regression tests for filter persistence, direct-record access, and global search safety

## Validation
- `vendor/bin/sail bin pint --dirty --format agent`
- `vendor/bin/sail artisan test --compact tests/Feature/Monitoring/OperationsKpiHeaderTenantContextTest.php tests/Feature/Monitoring/OperationsTenantScopeTest.php tests/Feature/Monitoring/OperationsCanonicalUrlsTest.php tests/Feature/Spec085/OperationsIndexHeaderTest.php tests/Feature/Spec085/RunDetailBackAffordanceTest.php tests/Feature/Filament/OperationRunListFiltersTest.php tests/Feature/Filament/EntraGroupAdminScopeTest.php tests/Feature/Filament/EntraGroupGlobalSearchScopeTest.php tests/Feature/DirectoryGroups/BrowseGroupsTest.php tests/Feature/Filament/EntraGroupEnterpriseDetailPageTest.php tests/Feature/Filament/PolicyVersionResolvedReferenceLinksTest.php tests/Feature/Filament/EntraGroupResolvedReferencePresentationTest.php tests/Feature/Guards/AdminTenantResolverGuardTest.php tests/Feature/OpsUx/OperateHubShellTest.php tests/Feature/Filament/Alerts/AlertsKpiHeaderTest.php tests/Feature/Alerts/AlertDeliveryDeepLinkFiltersTest.php`
- `vendor/bin/sail artisan test --compact tests/Feature/Filament/TableStatePersistenceTest.php tests/Feature/Filament/TenantScopingTest.php tests/Feature/Filament/Alerts/AlertDeliveryViewerTest.php tests/Unit/Support/References/CapabilityAwareReferenceResolverTest.php`

## Notes
- Filament v5 remains on Livewire v4.0+ compliant surfaces only.
- No provider registration changes were needed; Laravel 12 provider registration remains in `bootstrap/providers.php`.
- Entra group global search remains enabled and is now scoped to the canonical admin tenant contract.

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #164
2026-03-11 21:24:28 +00:00

45 lines
1.4 KiB
PHP

<?php
declare(strict_types=1);
use App\Filament\Resources\EntraGroupResource;
use App\Filament\Resources\PolicyVersionResource;
use App\Models\EntraGroup;
use App\Models\Policy;
use App\Models\PolicyVersion;
use Filament\Facades\Filament;
it('renders canonical group links for resolved assignment targets', function (): void {
[$user, $tenant] = createUserWithTenant(role: 'owner');
$this->actingAs($user);
Filament::setCurrentPanel('tenant');
Filament::bootCurrentPanel();
$groupId = '33333333-4444-5555-6666-777777777777';
$group = EntraGroup::factory()->for($tenant)->create([
'entra_id' => strtolower($groupId),
'display_name' => 'Scoped group',
]);
$policy = Policy::factory()->for($tenant)->create();
$version = PolicyVersion::factory()->for($tenant)->create([
'policy_id' => (int) $policy->getKey(),
'assignments' => [
[
'intent' => 'apply',
'target' => [
'@odata.type' => '#microsoft.graph.groupAssignmentTarget',
'groupId' => $groupId,
],
],
],
]);
$this->get(PolicyVersionResource::getUrl('view', ['record' => $version], panel: 'tenant', tenant: $tenant))
->assertOk()
->assertSee(EntraGroupResource::getUrl('view', ['record' => $group], panel: 'tenant', tenant: $tenant), false)
->assertSee('Scoped group');
});