## Summary - consolidate internal platform naming from `Tenant` to `Environment` / `ManagedEnvironment` across models, controllers, services, and Filament resources - rename environment-scoped UI surfaces such as dashboards, chooser flows, navigation, and related widgets to match the updated environment-first domain language - align middleware, onboarding/review lifecycle services, jobs, and route/context controllers with the new environment-scoped architecture ## Validation - not rerun as part of this commit/push/PR request ## Notes - branch is 1 commit ahead of `platform-dev` - main commit: `refactor: consolidate internal tenant model naming` Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #355
64 lines
2.8 KiB
PHP
64 lines
2.8 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Filament\Resources\ManagedEnvironmentResource;
|
|
use App\Models\OperationRun;
|
|
use App\Support\ManagedEnvironmentLinks;
|
|
use App\Support\OperationRunLinks;
|
|
use App\Support\Workspaces\WorkspaceContext;
|
|
|
|
it('generates canonical managed-environment route families only', function (): void {
|
|
[$user, $tenant] = createMinimalUserWithTenant(role: 'owner');
|
|
|
|
$this->actingAs($user)
|
|
->withSession([WorkspaceContext::SESSION_KEY => (int) $tenant->workspace_id]);
|
|
|
|
$urls = [
|
|
ManagedEnvironmentLinks::indexUrl($tenant),
|
|
ManagedEnvironmentLinks::viewUrl($tenant),
|
|
ManagedEnvironmentLinks::requiredPermissionsUrl($tenant),
|
|
ManagedEnvironmentLinks::diagnosticsUrl($tenant),
|
|
ManagedEnvironmentLinks::accessScopesUrl($tenant),
|
|
ManagedEnvironmentLinks::operationsUrl($tenant),
|
|
ManagedEnvironmentLinks::providerConnectionsUrl($tenant),
|
|
ManagedEnvironmentResource::getUrl('index'),
|
|
ManagedEnvironmentResource::getUrl('view', ['record' => $tenant]),
|
|
ManagedEnvironmentResource::getUrl('edit', ['record' => $tenant]),
|
|
ManagedEnvironmentResource::getUrl('memberships', ['record' => $tenant]),
|
|
OperationRunLinks::index($tenant),
|
|
];
|
|
|
|
$run = OperationRun::factory()->create([
|
|
'workspace_id' => (int) $tenant->workspace_id,
|
|
'managed_environment_id' => (int) $tenant->getKey(),
|
|
]);
|
|
|
|
$urls[] = OperationRunLinks::tenantlessView($run);
|
|
|
|
foreach ($urls as $url) {
|
|
expect($url)
|
|
->not->toContain('/admin/tenants')
|
|
->not->toContain('/admin/t/');
|
|
}
|
|
|
|
expect(ManagedEnvironmentLinks::viewUrl($tenant))->toContain('/admin/workspaces/')
|
|
->and(ManagedEnvironmentLinks::viewUrl($tenant))->toContain('/environments/'.$tenant->getRouteKey())
|
|
->and(ManagedEnvironmentLinks::requiredPermissionsUrl($tenant))->toEndWith('/required-permissions')
|
|
->and(ManagedEnvironmentLinks::diagnosticsUrl($tenant))->toEndWith('/diagnostics')
|
|
->and(ManagedEnvironmentLinks::accessScopesUrl($tenant))->toEndWith('/access-scopes')
|
|
->and(ManagedEnvironmentLinks::providerConnectionsUrl($tenant))->toContain('/admin/provider-connections?managed_environment_id='.(string) $tenant->external_id)
|
|
->and(OperationRunLinks::index($tenant))->toContain('/admin/workspaces/')
|
|
->and(OperationRunLinks::tenantlessView($run))->toContain('/admin/workspaces/');
|
|
});
|
|
|
|
it('keeps the retired ManagedEnvironmentResource out of global search', function (): void {
|
|
[$user, $tenant] = createMinimalUserWithTenant(role: 'owner');
|
|
|
|
$this->actingAs($user)
|
|
->withSession([WorkspaceContext::SESSION_KEY => (int) $tenant->workspace_id]);
|
|
|
|
expect(ManagedEnvironmentResource::getGlobalSearchResults((string) $tenant->name))->toHaveCount(0);
|
|
});
|
|
|