TenantAtlas/apps/platform/tests/Unit/Badges/RestoreUiBadgesTest.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

75 lines
3.2 KiB
PHP

<?php
declare(strict_types=1);
use App\Support\Badges\BadgeCatalog;
use App\Support\Badges\BadgeDomain;
it('maps restore preview decisions to canonical badge semantics', function (): void {
$created = BadgeCatalog::spec(BadgeDomain::RestorePreviewDecision, 'created');
expect($created->label)->toBe('Will create');
expect($created->color)->toBe('success');
$mappedExisting = BadgeCatalog::spec(BadgeDomain::RestorePreviewDecision, 'mapped_existing');
expect($mappedExisting->label)->toBe('Will map existing');
expect($mappedExisting->color)->toBe('info');
$createdCopy = BadgeCatalog::spec(BadgeDomain::RestorePreviewDecision, 'created_copy');
expect($createdCopy->label)->toBe('Will create copy');
expect($createdCopy->color)->toBe('warning');
$skipped = BadgeCatalog::spec(BadgeDomain::RestorePreviewDecision, 'skipped');
expect($skipped->label)->toBe('Will skip');
expect($skipped->color)->toBe('gray');
$failed = BadgeCatalog::spec(BadgeDomain::RestorePreviewDecision, 'failed');
expect($failed->label)->toBe('Cannot apply');
expect($failed->color)->toBe('danger');
$dryRun = BadgeCatalog::spec(BadgeDomain::RestorePreviewDecision, 'dry_run');
expect($dryRun->label)->toBe('Preview only');
expect($dryRun->color)->toBe('warning');
$current = BadgeCatalog::spec(BadgeDomain::RestorePreviewDecision, 'current');
expect($current->label)->toBe('Current basis');
expect($current->color)->toBe('success');
$invalidated = BadgeCatalog::spec(BadgeDomain::RestorePreviewDecision, 'invalidated');
expect($invalidated->label)->toBe('Invalidated');
expect($invalidated->color)->toBe('warning');
});
it('maps restore results statuses to canonical badge semantics', function (): void {
$applied = BadgeCatalog::spec(BadgeDomain::RestoreResultStatus, 'applied');
expect($applied->label)->toBe('Applied');
expect($applied->color)->toBe('success');
$dryRun = BadgeCatalog::spec(BadgeDomain::RestoreResultStatus, 'dry_run');
expect($dryRun->label)->toBe('Preview only');
expect($dryRun->color)->toBe('info');
$mapped = BadgeCatalog::spec(BadgeDomain::RestoreResultStatus, 'mapped');
expect($mapped->label)->toBe('Mapped to existing item');
expect($mapped->color)->toBe('info');
$skipped = BadgeCatalog::spec(BadgeDomain::RestoreResultStatus, 'skipped');
expect($skipped->label)->toBe('Not applied');
expect($skipped->color)->toBe('gray');
$manualRequired = BadgeCatalog::spec(BadgeDomain::RestoreResultStatus, 'manual_required');
expect($manualRequired->label)->toBe('Manual follow-up needed');
expect($manualRequired->color)->toBe('warning');
$failed = BadgeCatalog::spec(BadgeDomain::RestoreResultStatus, 'failed');
expect($failed->label)->toBe('Apply failed');
expect($failed->color)->toBe('danger');
$completed = BadgeCatalog::spec(BadgeDomain::RestoreResultStatus, 'completed');
expect($completed->label)->toBe('Completed');
expect($completed->color)->toBe('success');
$followUp = BadgeCatalog::spec(BadgeDomain::RestoreResultStatus, 'completed_with_follow_up');
expect($followUp->label)->toBe('Follow-up required');
expect($followUp->color)->toBe('warning');
});