TenantAtlas/tests/Feature/Onboarding/OnboardingCreateProviderConnectionTest.php
2026-02-01 12:20:18 +01:00

34 lines
1005 B
PHP

<?php
declare(strict_types=1);
use App\Filament\Resources\ProviderConnectionResource\Pages\CreateProviderConnection;
use App\Models\Tenant;
use App\Models\TenantMembership;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
uses(RefreshDatabase::class);
it('offers a create-provider-connection path from onboarding and allows returning', function () {
$tenant = Tenant::factory()->create(['status' => 'active']);
$onboardingUrl = "/admin/t/{$tenant->external_id}/onboarding";
$owner = User::factory()->create();
TenantMembership::query()->create([
'tenant_id' => $tenant->getKey(),
'user_id' => $owner->getKey(),
'role' => 'owner',
'source' => 'manual',
'source_ref' => null,
'created_by_user_id' => null,
]);
$this->actingAs($owner);
$response = $this->get($onboardingUrl)
->assertSuccessful();
$response->assertSee(CreateProviderConnection::getUrl(tenant: $tenant), escape: false);
});