32 lines
839 B
PHP
32 lines
839 B
PHP
<?php
|
|
|
|
use App\Filament\Resources\FindingResource\Pages\ListFindings;
|
|
use App\Models\Finding;
|
|
use Filament\Facades\Filament;
|
|
use Livewire\Livewire;
|
|
|
|
test('readonly users cannot acknowledge findings', function () {
|
|
[$user, $tenant] = createUserWithTenant(role: 'readonly');
|
|
$this->actingAs($user);
|
|
Filament::setTenant($tenant, true);
|
|
|
|
$finding = Finding::factory()->for($tenant)->create([
|
|
'finding_type' => Finding::FINDING_TYPE_DRIFT,
|
|
'status' => Finding::STATUS_NEW,
|
|
]);
|
|
|
|
$thrown = null;
|
|
|
|
try {
|
|
Livewire::test(ListFindings::class)
|
|
->callTableAction('acknowledge', $finding);
|
|
} catch (Throwable $exception) {
|
|
$thrown = $exception;
|
|
}
|
|
|
|
expect($thrown)->not->toBeNull();
|
|
|
|
$finding->refresh();
|
|
expect($finding->status)->toBe(Finding::STATUS_NEW);
|
|
});
|