actingAs($user); $tenant->makeCurrent(); Filament::setTenant($tenant, true); $connection = ProviderConnection::factory()->create([ 'tenant_id' => $tenant->getKey(), 'provider' => 'microsoft', 'entra_tenant_id' => fake()->uuid(), ]); $starter = app(StartVerification::class); $first = $starter->providerConnectionCheck( tenant: $tenant, connection: $connection, initiator: $user, extraContext: ['wizard' => ['flow' => 'managed_tenant_onboarding']], ); $second = $starter->providerConnectionCheck( tenant: $tenant, connection: $connection, initiator: $user, extraContext: ['wizard' => ['flow' => 'managed_tenant_onboarding']], ); expect($first->run->getKey())->toBe($second->run->getKey()); expect($first->status)->toBe('started'); expect($second->status)->toBe('deduped'); expect(OperationRun::query() ->where('tenant_id', $tenant->getKey()) ->where('type', 'provider.connection.check') ->count())->toBe(1); Queue::assertPushed(ProviderConnectionHealthCheckJob::class, 1); });