create(); $otherTenant = Tenant::factory()->create(); [$user] = createUserWithTenant($otherTenant, role: 'owner'); $this->actingAs($user) ->get(RestoreRunResource::getUrl('index', tenant: $tenant)) ->assertStatus(404); }); test('members without capability see RestoreRun actions disabled with standard tooltip and cannot execute', function () { $tenant = Tenant::factory()->create(); [$user] = createUserWithTenant($tenant, role: 'readonly'); $backupSet = BackupSet::factory()->create([ 'tenant_id' => $tenant->getKey(), 'status' => 'completed', ]); $restoreRun = RestoreRun::factory()->create([ 'tenant_id' => $tenant->getKey(), 'backup_set_id' => $backupSet->getKey(), 'status' => 'completed', 'deleted_at' => null, ]); Filament::setTenant($tenant, true); Livewire::actingAs($user) ->test(ListRestoreRuns::class) ->assertTableActionDisabled('archive', $restoreRun) ->assertTableActionExists('archive', fn ($action): bool => $action->getTooltip() === UiTooltips::insufficientPermission(), $restoreRun) ->callTableAction('archive', $restoreRun); expect($restoreRun->fresh()->trashed())->toBeFalse(); }); test('members with capability can execute RestoreRun actions', function () { $tenant = Tenant::factory()->create(); [$user] = createUserWithTenant($tenant, role: 'owner'); $backupSet = BackupSet::factory()->create([ 'tenant_id' => $tenant->getKey(), 'status' => 'completed', ]); $restoreRun = RestoreRun::factory()->create([ 'tenant_id' => $tenant->getKey(), 'backup_set_id' => $backupSet->getKey(), 'status' => 'completed', 'deleted_at' => null, ]); Filament::setTenant($tenant, true); Livewire::actingAs($user) ->test(ListRestoreRuns::class) ->assertTableActionEnabled('archive', $restoreRun) ->callTableAction('archive', $restoreRun); expect($restoreRun->fresh()->trashed())->toBeTrue(); });