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
35 lines
1.3 KiB
PHP
35 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Filament\Pages\TenantDashboard;
|
|
use App\Models\Tenant;
|
|
use App\Support\Workspaces\WorkspaceContext;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
it('ignores an intended tenant route that is not valid in the target workspace', function (): void {
|
|
$sourceTenant = Tenant::factory()->active()->create(['name' => 'Source Tenant']);
|
|
[$user, $sourceTenant] = createUserWithTenant(tenant: $sourceTenant, role: 'owner');
|
|
|
|
$targetWorkspaceTenant = Tenant::factory()->active()->create([
|
|
'name' => 'Target Tenant',
|
|
]);
|
|
createUserWithTenant(tenant: $targetWorkspaceTenant, user: $user, role: 'owner');
|
|
|
|
$targetWorkspace = $targetWorkspaceTenant->workspace()->firstOrFail();
|
|
|
|
$response = $this->actingAs($user)
|
|
->withSession([
|
|
WorkspaceContext::SESSION_KEY => (int) $sourceTenant->workspace_id,
|
|
WorkspaceContext::INTENDED_URL_SESSION_KEY => "/admin/t/{$sourceTenant->external_id}",
|
|
])
|
|
->post(route('admin.switch-workspace'), [
|
|
'workspace_id' => (int) $targetWorkspace->getKey(),
|
|
]);
|
|
|
|
$response->assertRedirect(TenantDashboard::getUrl(panel: 'tenant', tenant: $targetWorkspaceTenant));
|
|
expect(session(WorkspaceContext::SESSION_KEY))->toBe((int) $targetWorkspace->getKey());
|
|
});
|