## Summary - centralize all status-like badge semantics via `BadgeCatalog`/`BadgeRenderer` and new per-domain mappings plus coverage for every affected entity - replace ad-hoc badge colors in Filament tables/views with the shared catalog and add a guard test that blocks new inline semantics - stabilize restore views by avoiding `@php(...)` shorthand so Blade compiles cleanly, and document BADGE-001 in the constitution/templates ## Testing - `vendor/bin/sail php vendor/bin/pint --dirty` - `vendor/bin/sail artisan test tests/Unit/Badges tests/Feature/Guards/NoAdHocStatusBadgesTest.php` - `vendor/bin/sail artisan test tests/Feature/Monitoring/OperationsDbOnlyTest.php tests/Feature/Monitoring/OperationsTenantScopeTest.php` - `vendor/bin/sail artisan test tests/Feature/RestoreRunWizardMetadataTest.php tests/Feature/Filament/SettingsCatalogRestoreApplySettingsPatchTest.php` Co-authored-by: Ahmed Darrazi <ahmeddarrazi@adsmac.local> Reviewed-on: #71
39 lines
1.5 KiB
PHP
39 lines
1.5 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('Created');
|
|
expect($created->color)->toBe('success');
|
|
|
|
$mappedExisting = BadgeCatalog::spec(BadgeDomain::RestorePreviewDecision, 'mapped_existing');
|
|
expect($mappedExisting->label)->toBe('Mapped existing');
|
|
expect($mappedExisting->color)->toBe('info');
|
|
|
|
$failed = BadgeCatalog::spec(BadgeDomain::RestorePreviewDecision, 'failed');
|
|
expect($failed->label)->toBe('Failed');
|
|
expect($failed->color)->toBe('danger');
|
|
});
|
|
|
|
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('Dry run');
|
|
expect($dryRun->color)->toBe('info');
|
|
|
|
$manualRequired = BadgeCatalog::spec(BadgeDomain::RestoreResultStatus, 'manual_required');
|
|
expect($manualRequired->label)->toBe('Manual required');
|
|
expect($manualRequired->color)->toBe('warning');
|
|
|
|
$failed = BadgeCatalog::spec(BadgeDomain::RestoreResultStatus, 'failed');
|
|
expect($failed->label)->toBe('Failed');
|
|
expect($failed->color)->toBe('danger');
|
|
});
|