## 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.4 KiB
PHP
64 lines
2.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Models\ManagedEnvironment;
|
|
use App\Models\User;
|
|
use App\Models\Workspace;
|
|
use App\Models\WorkspaceMembership;
|
|
use App\Support\Workspaces\WorkspaceContext;
|
|
use Filament\Facades\Filament;
|
|
|
|
it('renders environment-first chooser terminology in english', function (): void {
|
|
$environment = ManagedEnvironment::factory()->active()->create(['name' => 'Chooser Environment']);
|
|
[$user, $environment] = createUserWithTenant(tenant: $environment, role: 'owner');
|
|
|
|
app()->setLocale('en');
|
|
Filament::setTenant(null, true);
|
|
|
|
$this->actingAs($user)
|
|
->withSession([WorkspaceContext::SESSION_KEY => (int) $environment->workspace_id])
|
|
->get('/admin/choose-environment')
|
|
->assertSuccessful()
|
|
->assertSee('Choose environment')
|
|
->assertSee('Select the environment for your normal active operating context.')
|
|
->assertSee('No environment selected is still a valid workspace state')
|
|
->assertDontSee('Choose tenant')
|
|
->assertDontSee('Select the tenant for your normal active operating context.')
|
|
->assertDontSee('No tenant selected is still a valid workspace state');
|
|
});
|
|
|
|
it('renders environment-first managed-environments landing terminology in english', function (): void {
|
|
$workspace = Workspace::factory()->create(['slug' => 'landing-environment-copy']);
|
|
$user = User::factory()->create();
|
|
|
|
WorkspaceMembership::factory()->create([
|
|
'workspace_id' => (int) $workspace->getKey(),
|
|
'user_id' => (int) $user->getKey(),
|
|
'role' => 'owner',
|
|
]);
|
|
|
|
$environment = ManagedEnvironment::factory()->active()->create([
|
|
'workspace_id' => (int) $workspace->getKey(),
|
|
'name' => 'Landing Environment',
|
|
]);
|
|
|
|
$user->tenants()->syncWithoutDetaching([
|
|
$environment->getKey() => ['role' => 'owner'],
|
|
]);
|
|
|
|
app()->setLocale('en');
|
|
Filament::setTenant(null, true);
|
|
|
|
$this->actingAs($user)
|
|
->withSession([WorkspaceContext::SESSION_KEY => (int) $workspace->getKey()])
|
|
->get(route('admin.workspace.managed-environments.index', ['workspace' => $workspace]))
|
|
->assertSuccessful()
|
|
->assertSee('Managed environments')
|
|
->assertSee('Choose environment')
|
|
->assertSee('Add environment')
|
|
->assertDontSee('Managed tenants')
|
|
->assertDontSee('Choose tenant')
|
|
->assertDontSee('Add tenant');
|
|
});
|