TenantAtlas/tests/Feature/Monitoring/OperationsActionsEnqueueRunTest.php

36 lines
950 B
PHP

<?php
use App\Models\OperationRun;
use App\Support\Workspaces\WorkspaceContext;
use Filament\Facades\Filament;
use Illuminate\Support\Facades\Bus;
use Illuminate\Support\Facades\Queue;
it('does not enqueue work while rendering Monitoring → Operations', function () {
[$user, $tenant] = createUserWithTenant(role: 'owner');
OperationRun::factory()->create([
'tenant_id' => $tenant->getKey(),
'type' => 'policy.sync',
'status' => 'queued',
'outcome' => 'pending',
'initiator_name' => 'System',
]);
$this->actingAs($user);
Bus::fake();
Queue::fake();
Filament::setTenant(null, true);
assertNoOutboundHttp(function () use ($tenant) {
$this->withSession([WorkspaceContext::SESSION_KEY => (int) $tenant->workspace_id])
->get('/admin/operations')
->assertOk();
});
Bus::assertNothingDispatched();
Queue::assertNothingPushed();
});