actingAs($user); $tenant->makeCurrent(); Filament::setTenant($tenant, true); $policy = Policy::factory()->for($tenant)->create(); Livewire::test(ViewPolicy::class, ['record' => $policy->getRouteKey()]) ->callAction('capture_snapshot', data: [ 'include_assignments' => true, 'include_scope_tags' => true, ]); Livewire::test(ViewPolicy::class, ['record' => $policy->getRouteKey()]) ->callAction('capture_snapshot', data: [ 'include_assignments' => true, 'include_scope_tags' => true, ]); $key = RunIdempotency::buildKey($tenant->getKey(), 'policy.capture_snapshot', $policy->getKey()); expect(BulkOperationRun::query() ->where('tenant_id', $tenant->id) ->where('idempotency_key', $key) ->count())->toBe(1); Queue::assertPushed(CapturePolicySnapshotJob::class, 1); });