TenantAtlas/tests/Unit/Findings/FindingExceptionBadgeTest.php
ahmido b1e1e06861 feat: implement finding risk acceptance lifecycle (#184)
## Summary
- add a first-class finding exception domain with request, approval, rejection, renewal, and revocation lifecycle support
- add tenant-scoped exception register, finding governance surfaces, and a canonical workspace approval queue in Filament
- add audit, badge, evidence, and review-pack integrations plus focused Pest coverage for workflow, authorization, and governance validity

## Validation
- vendor/bin/sail bin pint --dirty --format agent
- CI=1 vendor/bin/sail artisan test --compact
- manual integrated-browser smoke test for the request-exception happy path, tenant register visibility, and canonical queue visibility

## Notes
- Filament implementation remains on v5 with Livewire v4-compatible surfaces
- canonical queue lives in the admin panel; provider registration stays in bootstrap/providers.php
- finding exceptions stay out of global search in this rollout

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #184
2026-03-20 01:07:55 +00:00

44 lines
2.0 KiB
PHP

<?php
declare(strict_types=1);
use App\Models\FindingException;
use App\Support\Badges\BadgeCatalog;
use App\Support\Badges\BadgeDomain;
it('maps finding exception lifecycle states to canonical badge semantics', function (): void {
$pending = BadgeCatalog::spec(BadgeDomain::FindingExceptionStatus, FindingException::STATUS_PENDING);
expect($pending->label)->toBe('Pending')
->and($pending->color)->toBe('warning');
$expiring = BadgeCatalog::spec(BadgeDomain::FindingExceptionStatus, FindingException::STATUS_EXPIRING);
expect($expiring->label)->toBe('Expiring')
->and($expiring->color)->toBe('warning');
$expired = BadgeCatalog::spec(BadgeDomain::FindingExceptionStatus, FindingException::STATUS_EXPIRED);
expect($expired->label)->toBe('Expired')
->and($expired->color)->toBe('danger');
$revoked = BadgeCatalog::spec(BadgeDomain::FindingExceptionStatus, FindingException::STATUS_REVOKED);
expect($revoked->label)->toBe('Revoked')
->and($revoked->color)->toBe('danger');
});
it('maps governance validity states to canonical badge semantics', function (): void {
$valid = BadgeCatalog::spec(BadgeDomain::FindingRiskGovernanceValidity, FindingException::VALIDITY_VALID);
expect($valid->label)->toBe('Valid')
->and($valid->color)->toBe('success');
$expiring = BadgeCatalog::spec(BadgeDomain::FindingRiskGovernanceValidity, FindingException::VALIDITY_EXPIRING);
expect($expiring->label)->toBe('Expiring')
->and($expiring->color)->toBe('warning');
$expired = BadgeCatalog::spec(BadgeDomain::FindingRiskGovernanceValidity, FindingException::VALIDITY_EXPIRED);
expect($expired->label)->toBe('Expired')
->and($expired->color)->toBe('danger');
$missingSupport = BadgeCatalog::spec(BadgeDomain::FindingRiskGovernanceValidity, FindingException::VALIDITY_MISSING_SUPPORT);
expect($missingSupport->label)->toBe('Missing support')
->and($missingSupport->color)->toBe('gray');
});