TenantAtlas/tests/Feature/Badges/TenantStatusBadgeTest.php
ahmido 641bb4afde feat: implement tenant lifecycle operability semantics (#172)
## Summary
- implement Spec 143 tenant lifecycle, operability, and tenant-context semantics across chooser, tenant management, onboarding, and canonical operation viewers
- add centralized tenant lifecycle and operability support types, audit action coverage, and lifecycle-aware badge and action handling
- add feature and unit coverage for tenant chooser eligibility, global search scoping, canonical operation access, onboarding authorization, and lifecycle presentation

## Testing
- vendor/bin/sail artisan test --compact
- vendor/bin/sail bin pint --dirty --format agent

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #172
2026-03-15 09:08:36 +00:00

27 lines
942 B
PHP

<?php
declare(strict_types=1);
use App\Support\Badges\BadgeCatalog;
use App\Support\Badges\BadgeDomain;
it('maps every canonical tenant lifecycle to an explicit badge', function (string $input, string $label, string $color): void {
$spec = BadgeCatalog::spec(BadgeDomain::TenantStatus, $input);
expect($spec->label)->toBe($label)
->and($spec->color)->toBe($color);
})->with([
'draft' => ['draft', 'Draft', 'gray'],
'onboarding' => ['onboarding', 'Onboarding', 'warning'],
'active' => ['active', 'Active', 'success'],
'archived' => ['archived', 'Archived', 'gray'],
]);
it('normalizes legacy tenant lifecycle aliases before mapping', function (): void {
$pending = BadgeCatalog::spec(BadgeDomain::TenantStatus, 'PENDING');
$inactive = BadgeCatalog::spec(BadgeDomain::TenantStatus, 'inactive');
expect($pending->label)->toBe('Onboarding')
->and($inactive->label)->toBe('Archived');
});