TenantAtlas/tests/Feature/ManagedTenants/AuthorizationSemanticsTest.php
2026-02-01 10:49:19 +01:00

26 lines
692 B
PHP

<?php
declare(strict_types=1);
use App\Models\Tenant;
use App\Models\User;
it('returns 403 for a member without managed-tenant manage capability when accessing edit', function (): void {
$tenant = Tenant::factory()->create();
[$user] = createUserWithTenant($tenant, role: 'readonly');
$this->actingAs($user)
->get("/admin/managed-tenants/{$tenant->id}/edit")
->assertForbidden();
});
it('returns 404 for a non-member attempting to access the managed-tenant list', function (): void {
$tenant = Tenant::factory()->create();
$user = User::factory()->create();
$this->actingAs($user)
->get('/admin/managed-tenants')
->assertNotFound();
});