TenantAtlas/tests/Feature/ProviderConnections/ProviderRbacCapabilitiesTest.php

19 lines
678 B
PHP

<?php
use Illuminate\Support\Facades\Gate;
it('grants provider capabilities per tenant role', function (string $role, bool $canView, bool $canManage, bool $canRun): void {
[$user, $tenant] = createUserWithTenant(role: $role);
$this->actingAs($user);
expect(Gate::allows('provider.view', $tenant))->toBe($canView);
expect(Gate::allows('provider.manage', $tenant))->toBe($canManage);
expect(Gate::allows('provider.run', $tenant))->toBe($canRun);
})->with([
'owner' => ['owner', true, true, true],
'manager' => ['manager', true, true, true],
'operator' => ['operator', true, false, true],
'readonly' => ['readonly', true, false, false],
]);