TenantAtlas/apps/platform/tests/Feature/Guards/OperationLifecycleOpsUxGuardTest.php
ahmido 292d555eac refactor: consolidate internal tenant model naming (#355)
## 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
2026-05-14 11:13:28 +00:00

45 lines
1.8 KiB
PHP

<?php
declare(strict_types=1);
use App\Services\Operations\OperationLifecyclePolicyValidator;
use Tests\Support\OpsUx\SourceFileScanner;
use Tests\Support\TestLaneManifest;
it('keeps ops ux governance retained in the heavy-governance inventory', function (): void {
$inventoryRecord = collect(TestLaneManifest::heavyGovernanceHotspotInventory())
->firstWhere('familyId', 'ops-ux-governance');
expect($inventoryRecord)->not->toBeNull()
->and($inventoryRecord['classificationId'])->toBe('surface-guard')
->and($inventoryRecord['status'])->toBe('retained');
});
it('keeps lifecycle bridge ownership and initiator-null notification discipline intact', function (): void {
$validator = app(OperationLifecyclePolicyValidator::class);
$result = $validator->validate();
expect($result['valid'])->toBeTrue();
$root = SourceFileScanner::projectRoot();
$operationRunService = SourceFileScanner::read($root.'/app/Services/OperationRunService.php');
expect($operationRunService)->toContain('if ($run->user instanceof User)')
->and($operationRunService)->toContain('OperationRunCompletedNotification')
->and($operationRunService)->toContain('bridgeFailedJobFailure');
$directBridgeJobs = [
$root.'/app/Jobs/CaptureBaselineSnapshotJob.php',
$root.'/app/Jobs/CompareBaselineToTenantJob.php',
$root.'/app/Jobs/RunInventorySyncJob.php',
$root.'/app/Jobs/SyncPoliciesJob.php',
$root.'/app/Jobs/BulkTenantSyncJob.php',
$root.'/app/Jobs/BulkBackupSetRestoreJob.php',
$root.'/app/Jobs/ComposeEnvironmentReviewJob.php',
];
foreach ($directBridgeJobs as $jobPath) {
expect(SourceFileScanner::read($jobPath))->toContain('BridgesFailedOperationRun');
}
})->group('ops-ux');