TenantAtlas/apps/platform/tests/Unit/Badges/PolicyBadgesTest.php
ahmido ce0615a9c1 Spec 182: relocate Laravel platform to apps/platform (#213)
## Summary
- move the Laravel application into `apps/platform` and keep the repository root for orchestration, docs, and tooling
- update the local command model, Sail/Docker wiring, runtime paths, and ignore rules around the new platform location
- add relocation quickstart/contracts plus focused smoke coverage for bootstrap, command model, routes, and runtime behavior

## Validation
- `cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/PlatformRelocation`
- integrated browser smoke validated `/up`, `/`, `/admin`, `/admin/choose-workspace`, and tenant route semantics for `200`, `403`, and `404`

## Remaining Rollout Checks
- validate Dokploy build context and working-directory assumptions against the new `apps/platform` layout
- confirm web, queue, and scheduler processes all start from the expected working directory in staging/production
- verify no legacy volume mounts or asset-publish paths still point at the old root-level `public/` or `storage/` locations

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #213
2026-04-08 08:40:47 +00:00

53 lines
2.1 KiB
PHP

<?php
declare(strict_types=1);
use App\Support\Badges\BadgeCatalog;
use App\Support\Badges\BadgeDomain;
use App\Support\Inventory\InventoryPolicyTypeMeta;
it('maps policy snapshot mode values to canonical badge semantics', function (): void {
$full = BadgeCatalog::spec(BadgeDomain::PolicySnapshotMode, 'full');
expect($full->label)->toBe('Full');
expect($full->color)->toBe('success');
$metadataOnly = BadgeCatalog::spec(BadgeDomain::PolicySnapshotMode, 'metadata_only');
expect($metadataOnly->label)->toBe('Metadata only');
expect($metadataOnly->color)->toBe('warning');
});
it('maps policy restore mode values to canonical badge semantics', function (): void {
$enabled = BadgeCatalog::spec(BadgeDomain::PolicyRestoreMode, 'enabled');
expect($enabled->label)->toBe('Enabled');
expect($enabled->color)->toBe('success');
$previewOnly = BadgeCatalog::spec(BadgeDomain::PolicyRestoreMode, 'preview-only');
expect($previewOnly->label)->toBe('Preview only');
expect($previewOnly->color)->toBe('warning');
});
it('maps policy risk values to canonical badge semantics', function (): void {
$low = BadgeCatalog::spec(BadgeDomain::PolicyRisk, 'low');
expect($low->label)->toBe('Low');
expect($low->color)->toBe('gray');
$mediumHigh = BadgeCatalog::spec(BadgeDomain::PolicyRisk, 'medium-high');
expect($mediumHigh->label)->toBe('Medium-high');
expect($mediumHigh->color)->toBe('danger');
});
it('maps ignored-at presence to canonical badge semantics', function (): void {
$notIgnored = BadgeCatalog::spec(BadgeDomain::IgnoredAt, null);
expect($notIgnored->label)->toBe('No');
expect($notIgnored->color)->toBe('gray');
$ignored = BadgeCatalog::spec(BadgeDomain::IgnoredAt, '2026-01-01T00:00:00Z');
expect($ignored->label)->toBe('Yes');
expect($ignored->color)->toBe('warning');
});
it('maps RBAC foundation restore modes to preview-only metadata', function (): void {
expect(InventoryPolicyTypeMeta::restoreMode('intuneRoleDefinition'))->toBe('preview-only');
expect(InventoryPolicyTypeMeta::restoreMode('intuneRoleAssignment'))->toBe('preview-only');
});