set('tenantpilot.onboarding.credentials_required', false); [$user, $portfolioTenant] = createUserWithTenant(role: 'owner'); $this->actingAs($user); $tenantGuid = fake()->uuid(); $existing = Tenant::factory()->create([ 'name' => 'Already Exists', 'tenant_id' => $tenantGuid, 'environment' => 'prod', 'status' => 'active', ]); $user->tenants()->syncWithoutDetaching([ $existing->getKey() => ['role' => 'owner'], ]); Livewire::withQueryParams([ 'tenant' => (string) $portfolioTenant->external_id, ])->test(TenantOnboardingWizard::class) ->goToNextWizardStep() ->fillForm([ 'name' => 'Attempt Duplicate', 'environment' => 'prod', 'tenant_id' => $tenantGuid, 'domain' => 'dup.example', ], 'form') ->goToNextWizardStep(); expect(Tenant::query()->where('tenant_id', $tenantGuid)->count())->toBe(1); });