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

43 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
use App\Models\OnboardingSession;
use App\Models\Tenant;
use App\Models\TenantMembership;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
uses(RefreshDatabase::class);
it('shows consent guidance in step 4 without leaking secrets', function () {
$tenant = Tenant::factory()->create([
'status' => 'active',
'app_client_secret' => 'should-not-leak',
]);
$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,
]);
OnboardingSession::factory()->create([
'tenant_id' => $tenant->getKey(),
'status' => 'in_progress',
'current_step' => 4,
]);
$this->actingAs($owner);
$this->get($onboardingUrl)
->assertSuccessful()
->assertSee('consent', escape: false)
->assertDontSee('should-not-leak', escape: false);
});