TenantAtlas/tests/Feature/Monitoring/OperationsDbOnlyTest.php
2026-01-20 19:17:54 +01:00

53 lines
1.4 KiB
PHP

<?php
use App\Filament\Resources\OperationRunResource;
use App\Models\OperationRun;
use Illuminate\Support\Facades\Bus;
it('renders Monitoring → Operations index DB-only (no outbound HTTP, no background work)', 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();
assertNoOutboundHttp(function () use ($tenant) {
$this->get(OperationRunResource::getUrl('index', tenant: $tenant))
->assertOk();
});
Bus::assertNothingDispatched();
});
it('renders Monitoring → Operations detail DB-only (no outbound HTTP, no background work)', function () {
[$user, $tenant] = createUserWithTenant(role: 'owner');
$run = OperationRun::factory()->create([
'tenant_id' => $tenant->getKey(),
'type' => 'policy.sync',
'status' => 'queued',
'outcome' => 'pending',
'initiator_name' => 'System',
]);
$this->actingAs($user);
Bus::fake();
assertNoOutboundHttp(function () use ($tenant, $run) {
$this->get(OperationRunResource::getUrl('view', ['record' => $run], tenant: $tenant))
->assertOk()
->assertSee('Policy sync');
});
Bus::assertNothingDispatched();
});