Some checks failed
Main Confidence / confidence (push) Failing after 43s
## Summary - consolidate workspace and tenant shell resolution behind a canonical resolved shell context - align workspace switching, tenant selection, and tenant clearing with the new recovery and fallback rules - add focused Pest coverage for shell resolution and update root dev orchestration so platform Vite starts correctly from repo-root commands ## Testing - cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/Monitoring/HeaderContextBarTest.php - cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/Workspaces/GlobalContextShellContractTest.php - manual integrated-browser smoke for tenant-bound shell actions and context recovery flows - validated corepack pnpm build:platform, corepack pnpm dev:platform, corepack pnpm dev:website, and corepack pnpm dev ## Notes - Livewire v4 / Filament v5 remain unchanged and provider registration stays in bootstrap/providers.php - no new globally searchable resources or destructive Filament actions were introduced Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #246
42 lines
1.6 KiB
PHP
42 lines
1.6 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Models\Tenant;
|
|
use App\Models\User;
|
|
use App\Support\Workspaces\WorkspaceContext;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
it('shows a recovery label when workspace-scoped surfaces render without an active workspace', function (): void {
|
|
$tenant = Tenant::factory()->active()->create(['name' => 'Recovery Tenant']);
|
|
[$user] = createUserWithTenant(tenant: $tenant, role: 'owner');
|
|
|
|
session()->forget(WorkspaceContext::SESSION_KEY);
|
|
|
|
$this->actingAs($user)
|
|
->get('/admin/workspaces')
|
|
->assertOk()
|
|
->assertSee('Context unavailable')
|
|
->assertSee('Choose workspace');
|
|
});
|
|
|
|
it('shows explicit recovery wording when an invalid tenant hint is discarded on a workspace route', function (): void {
|
|
$validTenant = Tenant::factory()->active()->create(['name' => 'Valid Workspace Tenant']);
|
|
[$user, $validTenant] = createUserWithTenant(tenant: $validTenant, role: 'owner');
|
|
|
|
$foreignTenant = Tenant::factory()->active()->create(['name' => 'Foreign Workspace Tenant']);
|
|
createUserWithTenant(tenant: $foreignTenant, user: User::factory()->create(), role: 'owner');
|
|
|
|
$this->actingAs($user)
|
|
->withSession([
|
|
WorkspaceContext::SESSION_KEY => (int) $validTenant->workspace_id,
|
|
])
|
|
->get(route('admin.operations.index', ['tenant' => $foreignTenant->external_id]))
|
|
->assertOk()
|
|
->assertSee('Context unavailable')
|
|
->assertSee('No tenant selected')
|
|
->assertDontSee('Tenant scope: '.$foreignTenant->name);
|
|
});
|