TenantAtlas/tests/Feature/OpsUx/NoQueuedDbNotificationsTest.php
2026-01-18 14:44:16 +01:00

31 lines
787 B
PHP

<?php
declare(strict_types=1);
use App\Services\OperationRunService;
use Filament\Facades\Filament;
it('does not emit database notifications when dispatching a queued operation', function (): void {
[$user, $tenant] = createUserWithTenant(role: 'owner');
$this->actingAs($user);
$tenant->makeCurrent();
Filament::setTenant($tenant, true);
/** @var OperationRunService $service */
$service = app(OperationRunService::class);
$run = $service->ensureRun(
tenant: $tenant,
type: 'policy.sync',
inputs: ['scope' => 'all'],
initiator: $user,
);
$service->dispatchOrFail($run, function (): void {
// no-op (dispatch succeeded)
});
expect($user->notifications()->count())->toBe(0);
})->group('ops-ux');