## 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
31 lines
1.1 KiB
PHP
31 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Support\Badges\BadgeCatalog;
|
|
use App\Support\Badges\BadgeDomain;
|
|
|
|
it('maps finding severity values to canonical badge semantics', function (): void {
|
|
$low = BadgeCatalog::spec(BadgeDomain::FindingSeverity, 'low');
|
|
expect($low->label)->toBe('Low');
|
|
expect($low->color)->toBe('gray');
|
|
|
|
$medium = BadgeCatalog::spec(BadgeDomain::FindingSeverity, 'medium');
|
|
expect($medium->label)->toBe('Medium');
|
|
expect($medium->color)->toBe('warning');
|
|
|
|
$high = BadgeCatalog::spec(BadgeDomain::FindingSeverity, 'high');
|
|
expect($high->label)->toBe('High');
|
|
expect($high->color)->toBe('danger');
|
|
});
|
|
|
|
it('maps finding status values to canonical badge semantics', function (): void {
|
|
$new = BadgeCatalog::spec(BadgeDomain::FindingStatus, 'new');
|
|
expect($new->label)->toBe('New');
|
|
expect($new->color)->toBe('warning');
|
|
|
|
$acknowledged = BadgeCatalog::spec(BadgeDomain::FindingStatus, 'acknowledged');
|
|
expect($acknowledged->label)->toBe('Acknowledged');
|
|
expect($acknowledged->color)->toBe('gray');
|
|
});
|