## Summary - restore broad full-suite green-signal coverage across platform governance, operations, onboarding, dashboard/productization, and customer review flows - align related platform tests and supporting behavior with the current expected state for this restoration pass - update the spec-candidates queue as part of the same suite-restoration sweep ## Validation - `cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Browser/Dashboard/TenantDashboardProductizationSmokeTest.php tests/Browser/Reviews/CustomerReviewWorkspaceSmokeTest.php tests/Browser/Spec194GovernanceFrictionSmokeTest.php tests/Browser/Spec265DecisionRegisterSmokeTest.php` Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #351
72 lines
2.6 KiB
PHP
72 lines
2.6 KiB
PHP
<?php
|
|
|
|
use App\Filament\Pages\TenantDashboard;
|
|
use App\Models\ManagedEnvironment;
|
|
use App\Models\User;
|
|
use App\Models\Workspace;
|
|
use App\Models\WorkspaceMembership;
|
|
use App\Support\Workspaces\WorkspaceContext;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
it('resolves the workspace environment shell by managed-environment slug during smoke login', function (): void {
|
|
[$user, $environment] = createUserWithTenant(role: 'owner', workspaceRole: 'manager');
|
|
$redirect = (string) parse_url(TenantDashboard::getUrl(tenant: $environment), PHP_URL_PATH);
|
|
|
|
$this
|
|
->get(route('admin.local.smoke-login', [
|
|
'email' => $user->email,
|
|
'workspace' => $environment->workspace->slug,
|
|
'tenant' => $environment->slug,
|
|
'redirect' => $redirect,
|
|
]))
|
|
->assertRedirect($redirect)
|
|
->assertSessionHas('current_workspace_id', (int) $environment->workspace_id);
|
|
});
|
|
|
|
it('returns not found when route binding targets an environment outside the requested workspace', function (): void {
|
|
[$user, $environment] = createUserWithTenant(role: 'owner');
|
|
$otherWorkspace = Workspace::factory()->create();
|
|
|
|
WorkspaceMembership::factory()->create([
|
|
'workspace_id' => (int) $otherWorkspace->getKey(),
|
|
'user_id' => (int) $user->getKey(),
|
|
'role' => 'owner',
|
|
]);
|
|
|
|
$this->actingAs($user)->withSession([
|
|
WorkspaceContext::SESSION_KEY => (int) $otherWorkspace->getKey(),
|
|
]);
|
|
|
|
$this
|
|
->get('/admin/tenants/'.$environment->slug.'/provider-connections')
|
|
->assertNotFound()
|
|
->assertHeaderMissing('Location');
|
|
});
|
|
|
|
it('allows workspace members to inherit managed-environment access during smoke login', function (): void {
|
|
$workspace = Workspace::factory()->create();
|
|
$environment = ManagedEnvironment::factory()->create([
|
|
'workspace_id' => (int) $workspace->getKey(),
|
|
]);
|
|
$user = User::factory()->create();
|
|
$redirect = (string) parse_url(TenantDashboard::getUrl(tenant: $environment), PHP_URL_PATH);
|
|
|
|
WorkspaceMembership::factory()->create([
|
|
'workspace_id' => (int) $workspace->getKey(),
|
|
'user_id' => (int) $user->getKey(),
|
|
'role' => 'manager',
|
|
]);
|
|
|
|
$this
|
|
->get(route('admin.local.smoke-login', [
|
|
'email' => $user->email,
|
|
'workspace' => $workspace->slug,
|
|
'tenant' => $environment->slug,
|
|
'redirect' => $redirect,
|
|
]))
|
|
->assertRedirect($redirect)
|
|
->assertSessionHas('current_workspace_id', (int) $workspace->getKey());
|
|
});
|