## 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
41 lines
1.1 KiB
PHP
41 lines
1.1 KiB
PHP
<?php
|
|
|
|
use App\Filament\Resources\TenantResource;
|
|
use App\Models\Tenant;
|
|
use App\Models\User;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
it('allows members to access the tenant dashboard route for archived tenants', function () {
|
|
[$user, $tenant] = createUserWithTenant(role: 'readonly');
|
|
|
|
$tenant->delete();
|
|
|
|
$this->actingAs($user)
|
|
->get("/admin/t/{$tenant->external_id}")
|
|
->assertSuccessful();
|
|
});
|
|
|
|
it('returns 404 for non-members on the tenant dashboard route for archived tenants', function () {
|
|
$tenant = Tenant::factory()->create(['external_id' => 'archived-tenant-a']);
|
|
$tenant->delete();
|
|
|
|
$user = User::factory()->create();
|
|
|
|
$this->actingAs($user)
|
|
->get("/admin/t/{$tenant->external_id}")
|
|
->assertNotFound();
|
|
});
|
|
|
|
it('allows members to inspect the admin tenant view for archived tenants', function () {
|
|
[$user, $tenant] = createUserWithTenant(role: 'owner');
|
|
|
|
$tenant->delete();
|
|
|
|
$this->actingAs($user)
|
|
->get(TenantResource::getUrl('view', ['record' => $tenant]))
|
|
->assertSuccessful()
|
|
->assertSee('Archived');
|
|
});
|