## 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
125 lines
3.7 KiB
PHP
125 lines
3.7 KiB
PHP
<?php
|
|
|
|
use App\Services\Intune\ManagedEnvironmentRequiredPermissionsViewModelBuilder;
|
|
use App\Support\Verification\VerificationReportOverall;
|
|
|
|
it('maps overall to blocked when any application permission is missing', function (): void {
|
|
$rows = [
|
|
[
|
|
'key' => 'A',
|
|
'type' => 'application',
|
|
'description' => null,
|
|
'features' => ['backup'],
|
|
'status' => 'missing',
|
|
'details' => null,
|
|
],
|
|
[
|
|
'key' => 'B',
|
|
'type' => 'delegated',
|
|
'description' => null,
|
|
'features' => ['backup'],
|
|
'status' => 'missing',
|
|
'details' => null,
|
|
],
|
|
];
|
|
|
|
expect(ManagedEnvironmentRequiredPermissionsViewModelBuilder::deriveOverallStatus($rows))
|
|
->toBe(VerificationReportOverall::Blocked->value);
|
|
});
|
|
|
|
it('maps overall to needs_attention when only delegated permissions are missing', function (): void {
|
|
$rows = [
|
|
[
|
|
'key' => 'A',
|
|
'type' => 'application',
|
|
'description' => null,
|
|
'features' => ['backup'],
|
|
'status' => 'granted',
|
|
'details' => null,
|
|
],
|
|
[
|
|
'key' => 'B',
|
|
'type' => 'delegated',
|
|
'description' => null,
|
|
'features' => ['backup'],
|
|
'status' => 'missing',
|
|
'details' => null,
|
|
],
|
|
];
|
|
|
|
expect(ManagedEnvironmentRequiredPermissionsViewModelBuilder::deriveOverallStatus($rows))
|
|
->toBe(VerificationReportOverall::NeedsAttention->value);
|
|
});
|
|
|
|
it('maps overall to needs_attention when any permission is in error', function (): void {
|
|
$rows = [
|
|
[
|
|
'key' => 'A',
|
|
'type' => 'application',
|
|
'description' => null,
|
|
'features' => ['backup'],
|
|
'status' => 'granted',
|
|
'details' => null,
|
|
],
|
|
[
|
|
'key' => 'B',
|
|
'type' => 'application',
|
|
'description' => null,
|
|
'features' => ['backup'],
|
|
'status' => 'error',
|
|
'details' => ['source' => 'graph_api'],
|
|
],
|
|
];
|
|
|
|
expect(ManagedEnvironmentRequiredPermissionsViewModelBuilder::deriveOverallStatus($rows))
|
|
->toBe(VerificationReportOverall::NeedsAttention->value);
|
|
});
|
|
|
|
it('maps overall to ready when nothing is missing', function (): void {
|
|
$rows = [
|
|
[
|
|
'key' => 'A',
|
|
'type' => 'application',
|
|
'description' => null,
|
|
'features' => ['backup'],
|
|
'status' => 'granted',
|
|
'details' => null,
|
|
],
|
|
[
|
|
'key' => 'B',
|
|
'type' => 'delegated',
|
|
'description' => null,
|
|
'features' => ['backup'],
|
|
'status' => 'granted',
|
|
'details' => null,
|
|
],
|
|
];
|
|
|
|
expect(ManagedEnvironmentRequiredPermissionsViewModelBuilder::deriveOverallStatus($rows))
|
|
->toBe(VerificationReportOverall::Ready->value);
|
|
});
|
|
|
|
it('maps overall to needs_attention when freshness is stale without explicit permission gaps', function (): void {
|
|
$rows = [
|
|
[
|
|
'key' => 'A',
|
|
'type' => 'application',
|
|
'description' => null,
|
|
'features' => ['backup'],
|
|
'status' => 'granted',
|
|
'details' => null,
|
|
],
|
|
[
|
|
'key' => 'B',
|
|
'type' => 'delegated',
|
|
'description' => null,
|
|
'features' => ['backup'],
|
|
'status' => 'granted',
|
|
'details' => null,
|
|
],
|
|
];
|
|
|
|
expect(ManagedEnvironmentRequiredPermissionsViewModelBuilder::deriveOverallStatus($rows, true))
|
|
->toBe(VerificationReportOverall::NeedsAttention->value);
|
|
});
|