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

73 lines
3.0 KiB
PHP

<?php
declare(strict_types=1);
use App\Support\Badges\BadgeCatalog;
use App\Support\Badges\BadgeDomain;
it('maps restore run status values to canonical badge semantics', function (): void {
$draft = BadgeCatalog::spec(BadgeDomain::RestoreRunStatus, 'draft');
expect($draft->label)->toBe('Draft');
expect($draft->color)->toBe('gray');
$previewed = BadgeCatalog::spec(BadgeDomain::RestoreRunStatus, 'previewed');
expect($previewed->label)->toBe('Preview ready');
expect($previewed->color)->toBe('gray');
$queued = BadgeCatalog::spec(BadgeDomain::RestoreRunStatus, 'queued');
expect($queued->label)->toBe('Queued for execution');
expect($queued->color)->toBe('info');
$running = BadgeCatalog::spec(BadgeDomain::RestoreRunStatus, 'running');
expect($running->label)->toBe('Applying restore');
expect($running->color)->toBe('info');
$completed = BadgeCatalog::spec(BadgeDomain::RestoreRunStatus, 'completed');
expect($completed->label)->toBe('Applied successfully');
expect($completed->color)->toBe('success');
$partial = BadgeCatalog::spec(BadgeDomain::RestoreRunStatus, 'partial');
expect($partial->label)->toBe('Applied with follow-up');
expect($partial->color)->toBe('warning');
$completedWithErrors = BadgeCatalog::spec(BadgeDomain::RestoreRunStatus, 'completed_with_errors');
expect($completedWithErrors->label)->toBe('Applied with follow-up');
expect($completedWithErrors->color)->toBe('warning');
$failed = BadgeCatalog::spec(BadgeDomain::RestoreRunStatus, 'failed');
expect($failed->label)->toBe('Restore failed');
expect($failed->color)->toBe('danger');
$aborted = BadgeCatalog::spec(BadgeDomain::RestoreRunStatus, 'aborted');
expect($aborted->label)->toBe('Stopped early');
expect($aborted->color)->toBe('gray');
});
it('never represents a completed outcome with warning/attention meaning', function (): void {
$completed = BadgeCatalog::spec(BadgeDomain::RestoreRunStatus, 'completed');
expect($completed->color)->not->toBe('warning');
});
it('maps restore safety check severity values to canonical badge semantics', function (): void {
$blocking = BadgeCatalog::spec(BadgeDomain::RestoreCheckSeverity, 'blocking');
expect($blocking->label)->toBe('Fix before running');
expect($blocking->color)->toBe('danger');
$warning = BadgeCatalog::spec(BadgeDomain::RestoreCheckSeverity, 'warning');
expect($warning->label)->toBe('Review before running');
expect($warning->color)->toBe('warning');
$safe = BadgeCatalog::spec(BadgeDomain::RestoreCheckSeverity, 'safe');
expect($safe->label)->toBe('Ready to continue');
expect($safe->color)->toBe('success');
$current = BadgeCatalog::spec(BadgeDomain::RestoreCheckSeverity, 'current');
expect($current->label)->toBe('Current checks');
expect($current->color)->toBe('success');
$invalidated = BadgeCatalog::spec(BadgeDomain::RestoreCheckSeverity, 'invalidated');
expect($invalidated->label)->toBe('Invalidated');
expect($invalidated->color)->toBe('warning');
});