TenantAtlas/apps/platform/tests/Feature/ProviderConnections/ManageCapabilityEnforcementTest.php
ahmido eced9ad50c Spec 315: implement environment CTA explicit filter contract (#370)
## 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
2026-05-16 11:50:20 +00:00

28 lines
865 B
PHP

<?php
declare(strict_types=1);
use App\Models\ProviderConnection;
it('returns 403 for tenant members without PROVIDER_MANAGE capability on create and edit', function (): void {
[$user, $tenant] = createUserWithTenant(role: 'readonly');
$connection = ProviderConnection::factory()->create([
'workspace_id' => (int) $tenant->workspace_id,
'managed_environment_id' => (int) $tenant->getKey(),
'provider' => 'microsoft',
]);
$this->actingAs($user)
->get('/admin/provider-connections/create?environment_id='.(int) $tenant->getKey())
->assertForbidden();
$this->actingAs($user)
->get('/admin/provider-connections/'.$connection->getKey())
->assertOk();
$this->actingAs($user)
->get('/admin/provider-connections/'.$connection->getKey().'/edit')
->assertForbidden();
});