## 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
72 lines
2.7 KiB
PHP
72 lines
2.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Filament\Resources\ManagedEnvironmentResource;
|
|
use App\Models\ProviderConnection;
|
|
use App\Support\Providers\ProviderConsentStatus;
|
|
use App\Support\Providers\ProviderVerificationStatus;
|
|
|
|
it('renders provider health context on the canonical environment dashboard', function (): void {
|
|
[$user, $tenant] = createUserWithTenant(role: 'owner');
|
|
|
|
$this->actingAs($user)
|
|
->get(ManagedEnvironmentResource::getUrl('view', ['record' => $tenant], tenant: $tenant))
|
|
->assertOk()
|
|
->assertSee('Environment governance overview')
|
|
->assertSee('Provider Health');
|
|
});
|
|
|
|
it('keeps provider health context when the environment needs a default microsoft connection', function (): void {
|
|
$tenant = \App\Models\ManagedEnvironment::factory()->active()->create();
|
|
[$user, $tenant] = createUserWithTenant(
|
|
tenant: $tenant,
|
|
role: 'owner',
|
|
ensureDefaultMicrosoftProviderConnection: false,
|
|
);
|
|
|
|
\App\Models\ProviderConnection::factory()->create([
|
|
'workspace_id' => (int) $tenant->workspace_id,
|
|
'managed_environment_id' => (int) $tenant->getKey(),
|
|
'provider' => 'microsoft',
|
|
'display_name' => 'Fallback Connection',
|
|
'is_default' => false,
|
|
]);
|
|
|
|
$this->actingAs($user)
|
|
->get(ManagedEnvironmentResource::getUrl('view', ['record' => $tenant], tenant: $tenant))
|
|
->assertOk()
|
|
->assertSee('Environment governance overview')
|
|
->assertSee('Provider Health');
|
|
});
|
|
|
|
it('renders the environment dashboard provider health summary from the default connection', function (): void {
|
|
$tenant = \App\Models\ManagedEnvironment::factory()->active()->create();
|
|
[$user, $tenant] = createUserWithTenant(
|
|
tenant: $tenant,
|
|
role: 'owner',
|
|
ensureDefaultMicrosoftProviderConnection: false,
|
|
);
|
|
|
|
ProviderConnection::factory()->create([
|
|
'workspace_id' => (int) $tenant->workspace_id,
|
|
'managed_environment_id' => (int) $tenant->getKey(),
|
|
'provider' => 'microsoft',
|
|
'display_name' => 'Canonical Summary Connection',
|
|
'is_default' => true,
|
|
'is_enabled' => false,
|
|
'consent_status' => ProviderConsentStatus::Granted->value,
|
|
'verification_status' => ProviderVerificationStatus::Healthy->value,
|
|
]);
|
|
|
|
$this->actingAs($user)
|
|
->get(ManagedEnvironmentResource::getUrl('view', ['record' => $tenant], tenant: $tenant))
|
|
->assertOk()
|
|
->assertSee('Provider Health')
|
|
->assertSee('Canonical Summary Connection')
|
|
->assertSee('Disabled')
|
|
->assertSee('Healthy')
|
|
->assertDontSee('Connected')
|
|
->assertDontSee('Legacy health');
|
|
});
|