TenantAtlas/tests/Feature/TenantRBAC/TenantGuidVsBigintGuardTest.php

29 lines
817 B
PHP

<?php
declare(strict_types=1);
use App\Filament\Pages\TenantDiagnostics;
use App\Models\Tenant;
use Filament\Facades\Filament;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Livewire\Livewire;
uses(RefreshDatabase::class);
it('does not use external GUID where internal tenant id is required (diagnostics page loads)', function () {
[$user, $tenant] = createUserWithTenant(role: 'owner');
// Ensure the tenant has a GUID-like external identifier (this is the tenant route key).
$tenant->forceFill([
'external_id' => '00000000-0000-0000-0000-000000000123',
'tenant_id' => '00000000-0000-0000-0000-000000000123',
])->save();
$this->actingAs($user);
Filament::setTenant($tenant, true);
Livewire::test(TenantDiagnostics::class)
->assertSuccessful();
});