## 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
26 lines
891 B
PHP
26 lines
891 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Models\Tenant;
|
|
use App\Support\Tenants\TenantLifecycle;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
it('normalizes canonical and aliased lifecycle values', function (string $input, TenantLifecycle $expected): void {
|
|
expect(TenantLifecycle::fromValue($input))->toBe($expected);
|
|
})->with([
|
|
'draft' => ['draft', TenantLifecycle::Draft],
|
|
'onboarding' => ['onboarding', TenantLifecycle::Onboarding],
|
|
'active' => ['active', TenantLifecycle::Active],
|
|
'archived' => ['archived', TenantLifecycle::Archived],
|
|
'pending alias' => ['pending', TenantLifecycle::Onboarding],
|
|
]);
|
|
|
|
it('derives archived lifecycle from soft-deleted tenants', function (): void {
|
|
$tenant = Tenant::factory()->archived()->create();
|
|
|
|
expect(TenantLifecycle::fromTenant($tenant))->toBe(TenantLifecycle::Archived);
|
|
});
|