TenantAtlas/tests/Unit/RequiredPermissionsLinksTest.php
ahmido 3f09fd50f6 feat(spec-080): workspace-managed tenant administration migration (#97)
Implements Spec 080: split Filament into workspace-managed `/admin/*` (manage) vs tenant operations `/admin/t/{tenant}/*` (operate).

Highlights:
- Adds tenant operations panel (`tenant`) at `/admin/t` with tenancy by `Tenant.external_id`
- Keeps management resources in workspace panel (`admin`) under `/admin/tenants/*`
- Moves Provider Connections to workspace-managed routes: `/admin/tenants/{tenant}/provider-connections`
- Adds discoverability CTA on tenant view (Actions → Provider connections)
- Adds/updates Pest regression tests for routing boundaries, 404/403 RBAC-UX semantics, and global search isolation
- Includes full Spec Kit artifacts under `specs/080-workspace-managed-tenant-admin/`

Validation:
- `vendor/bin/sail bin pint --dirty`
- `vendor/bin/sail artisan test --compact tests/Feature/Spec080WorkspaceManagedTenantAdminMigrationTest.php`

Co-authored-by: Ahmed Darrazi <ahmeddarrazi@MacBookPro.fritz.box>
Reviewed-on: #97
2026-02-07 19:45:13 +00:00

27 lines
815 B
PHP

<?php
use App\Models\Tenant;
use App\Support\Links\RequiredPermissionsLinks;
it('builds a tenant-scoped required permissions link without filters', function (): void {
$tenant = Tenant::factory()->make([
'external_id' => 'tenant-123',
]);
expect(RequiredPermissionsLinks::requiredPermissions($tenant))
->toBe('/admin/tenants/tenant-123/required-permissions');
});
it('builds a tenant-scoped required permissions link with filters', function (): void {
$tenant = Tenant::factory()->make([
'external_id' => 'tenant 123',
]);
$url = RequiredPermissionsLinks::requiredPermissions($tenant, [
'status' => 'all',
'type' => 'application',
]);
expect($url)->toBe('/admin/tenants/tenant+123/required-permissions?status=all&type=application');
});