## Summary - replace tenant-first operator copy with environment and managed environment terminology across Filament pages, resources, services, Blade views, and localization - align baseline compare, findings, governance, monitoring, backup schedule, and required-permissions surfaces with the managed-environment vocabulary - update guard, feature, and browser smoke coverage and add the Spec 298 audit artifacts documenting allowed provider, internal, and regression-guard tenant references ## Validation - cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/Guards - cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/Localization - cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/Workspaces - cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/ProviderConnections - cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/RequiredPermissions - cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Browser/Spec190BaselineCompareMatrixSmokeTest.php tests/Browser/Spec281ProviderConnectionScopeSmokeTest.php tests/Browser/Spec285WorkspaceRbacEnvironmentAccessSmokeTest.php tests/Browser/Dashboard/TenantDashboardProductizationSmokeTest.php - cd apps/platform && ./vendor/bin/sail bin pint --dirty --format agent ## Notes - Filament remains on Livewire v4. - No panel provider or asset-strategy changes are included in this branch. - Existing destructive actions retain their confirmation and authorization behavior. Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #353
52 lines
2.0 KiB
PHP
52 lines
2.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Filament\Resources\BaselineProfileResource;
|
|
use App\Models\BaselineProfile;
|
|
use App\Support\Baselines\BaselineProfileStatus;
|
|
use Filament\Facades\Filament;
|
|
use Illuminate\Http\Request;
|
|
|
|
it('keeps baseline profiles workspace-owned while environment navigation is route scoped', function (): void {
|
|
Filament::setCurrentPanel('admin');
|
|
|
|
[$user, $tenant] = createUserWithTenant(role: 'owner');
|
|
|
|
app()->instance('request', Request::create('/admin/workspaces/'.$tenant->workspace_id));
|
|
|
|
expect(BaselineProfileResource::shouldRegisterNavigation())->toBeFalse();
|
|
|
|
app()->instance('request', Request::create('/admin/workspaces/'.$tenant->workspace_id.'/environments/'.$tenant->slug));
|
|
|
|
expect(BaselineProfileResource::shouldRegisterNavigation())->toBeTrue();
|
|
|
|
$this->actingAs($user)
|
|
->withSession([\App\Support\Workspaces\WorkspaceContext::SESSION_KEY => (int) $tenant->workspace_id])
|
|
->get("/admin/t/{$tenant->external_id}")
|
|
->assertNotFound();
|
|
});
|
|
|
|
it('keeps baseline profile urls workspace-owned even when a tenant context exists', function (): void {
|
|
[$user, $tenant] = createUserWithTenant(role: 'owner');
|
|
|
|
$profile = BaselineProfile::factory()->create([
|
|
'workspace_id' => (int) $tenant->workspace_id,
|
|
'status' => BaselineProfileStatus::Archived->value,
|
|
]);
|
|
|
|
$this->actingAs($user)
|
|
->withSession([\App\Support\Workspaces\WorkspaceContext::SESSION_KEY => (int) $tenant->workspace_id]);
|
|
|
|
$workspaceUrl = BaselineProfileResource::getUrl(panel: 'admin');
|
|
|
|
expect($workspaceUrl)->toContain('/admin/baseline-profiles');
|
|
expect($workspaceUrl)->not->toContain("/admin/t/{$tenant->external_id}/baseline-profiles");
|
|
|
|
$this->get($workspaceUrl)->assertOk();
|
|
$this->get(BaselineProfileResource::getUrl('view', ['record' => $profile], panel: 'admin'))->assertOk();
|
|
$this->get("/admin/t/{$tenant->external_id}/baseline-profiles")->assertNotFound();
|
|
|
|
expect($profile->fresh()->status)->toBe(BaselineProfileStatus::Archived);
|
|
});
|