TenantAtlas/tests/Feature/Filament/WorkspaceOverviewAccessTest.php
2026-03-09 22:52:00 +01:00

27 lines
819 B
PHP

<?php
declare(strict_types=1);
use App\Models\User;
use App\Models\Workspace;
use App\Models\WorkspaceMembership;
use App\Support\Workspaces\WorkspaceContext;
it('allows a workspace member to open the workspace overview without tenant context', function (): void {
$user = User::factory()->create();
$workspace = Workspace::factory()->create(['name' => 'Northwind Workspace']);
WorkspaceMembership::factory()->create([
'workspace_id' => (int) $workspace->getKey(),
'user_id' => (int) $user->getKey(),
'role' => 'readonly',
]);
$this->actingAs($user)
->withSession([WorkspaceContext::SESSION_KEY => (int) $workspace->getKey()])
->get('/admin')
->assertOk()
->assertSee('Workspace overview')
->assertSee('Northwind Workspace');
});