TenantAtlas/apps/platform/tests/Feature/Guards/FixtureCostProfilesGuardTest.php
ahmido d8e331e92f Spec 207: implement shared test fixture slimming (#240)
## Summary
- implement the canonical shared fixture profile model with minimal, standard, and full semantics plus temporary legacy alias resolution
- slim default factory behavior for operation runs, backup sets, provider connections, and provider credentials while keeping explicit heavy opt-in states
- migrate the first console, navigation, RBAC, and drift caller packs to explicit lean helpers and wire lane comparison reporting into the existing Spec 206 seams
- reconcile spec 207 docs, contracts, quickstart guidance, and task tracking with the implemented behavior

## Validation
- `cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Unit/Support/CreateUserWithTenantProfilesTest.php tests/Unit/Factories/TenantFactoryTest.php tests/Unit/Factories/OperationRunFactoryTest.php tests/Unit/Factories/BackupSetFactoryTest.php tests/Unit/Factories/ProviderConnectionFactoryTest.php tests/Unit/Factories/ProviderCredentialFactoryTest.php tests/Feature/Guards/FixtureCostProfilesGuardTest.php tests/Feature/Guards/FixtureLaneImpactBudgetTest.php tests/Feature/Guards/TestLaneArtifactsContractTest.php tests/Feature/Console/ReconcileOperationRunsCommandTest.php tests/Feature/Console/ReconcileBackupScheduleOperationRunsCommandTest.php tests/Feature/Navigation/RelatedNavigationResolverMemoizationTest.php tests/Feature/Spec080WorkspaceManagedTenantAdminMigrationTest.php tests/Feature/BaselineDriftEngine/FindingFidelityTest.php`
- `cd apps/platform && ./vendor/bin/sail bin pint --dirty --format agent`
- `./scripts/platform-test-lane fast-feedback`
- `./scripts/platform-test-lane confidence`
- `./scripts/platform-test-report fast-feedback`
- `./scripts/platform-test-report confidence`

## Lane outcome
- `fast-feedback`: 136.400761s vs 176.73623s baseline, status `improved`
- `confidence`: 394.5669s vs 394.383441s baseline, status `stable`

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #240
2026-04-16 17:29:25 +00:00

81 lines
2.9 KiB
PHP

<?php
declare(strict_types=1);
it('keeps the canonical shared tenant helper profile catalog explicit and reviewable', function (): void {
$profiles = createUserWithTenantProfileCatalog();
expect($profiles)->toHaveKeys([
'minimal',
'standard',
'full',
])
->and($profiles['minimal'])->toMatchArray([
'workspace' => true,
'membership' => true,
'session' => true,
'provider' => false,
'credential' => false,
'cache' => false,
'uiContext' => false,
])
->and($profiles['standard'])->toMatchArray([
'workspace' => true,
'membership' => true,
'session' => true,
'provider' => true,
'credential' => false,
'cache' => false,
'uiContext' => false,
])
->and($profiles['full'])->toMatchArray([
'workspace' => true,
'membership' => true,
'session' => true,
'provider' => true,
'credential' => true,
'cache' => true,
'uiContext' => true,
]);
});
it('keeps the temporary legacy fixture aliases explicit and reviewable', function (): void {
$aliases = createUserWithTenantLegacyProfileAliases();
expect($aliases)->toHaveKeys([
'provider-enabled',
'credential-enabled',
'ui-context',
'heavy',
])
->and($aliases['provider-enabled']['profile'])->toBe('standard')
->and($aliases['credential-enabled']['profile'])->toBe('full')
->and($aliases['ui-context']['profile'])->toBe('full')
->and($aliases['heavy']['profile'])->toBe('full')
->and($aliases['provider-enabled']['removalTrigger'])->not->toBe('')
->and($aliases['credential-enabled']['removalTrigger'])->not->toBe('')
->and($aliases['ui-context']['removalTrigger'])->not->toBe('')
->and($aliases['heavy']['removalTrigger'])->not->toBe('');
});
it('resolves legacy aliases to the promised side-effect bundles', function (): void {
$credentialEnabled = resolveCreateUserWithTenantProfile('credential-enabled');
$uiContext = resolveCreateUserWithTenantProfile('ui-context');
expect($credentialEnabled['canonicalProfile'])->toBe('full')
->and($credentialEnabled['legacyAlias'])->toBe('credential-enabled')
->and($credentialEnabled['sideEffects'])->toMatchArray([
'provider' => true,
'credential' => true,
'cache' => false,
'uiContext' => false,
])
->and($uiContext['canonicalProfile'])->toBe('full')
->and($uiContext['legacyAlias'])->toBe('ui-context')
->and($uiContext['sideEffects'])->toMatchArray([
'provider' => false,
'credential' => false,
'cache' => true,
'uiContext' => true,
]);
});