false]); $tenant = Tenant::factory()->create([ 'status' => 'active', ]); $run = OperationRun::factory()->create([ 'tenant_id' => $tenant->getKey(), 'type' => 'policy.sync', 'status' => OperationRunStatus::Queued->value, 'outcome' => OperationRunOutcome::Pending->value, ]); $job = new SyncPoliciesJob( tenantId: (int) $tenant->getKey(), types: null, policyIds: null, operationRun: $run, ); $job->handle(app(PolicySyncService::class), app(OperationRunService::class)); $run->refresh(); expect($run->status)->toBe(OperationRunStatus::Completed->value); expect($run->outcome)->toBe(OperationRunOutcome::Failed->value); $failures = is_array($run->failure_summary ?? null) ? $run->failure_summary : []; expect($failures)->not->toBeEmpty(); expect($failures[0]['code'] ?? null)->toBe('graph.disabled'); });