Some checks failed
Main Confidence / confidence (push) Failing after 58s
## Summary - remove deprecated baseline profile status alias constants and keep baseline lifecycle semantics on the canonical enum path - retire the dead tenant app-status badge/default-fixture residue from the active runtime support path - add the `234-dead-transitional-residue` spec, plan, research, data-model, quickstart, checklist, and task artifacts plus focused regression assertions ## Validation - not rerun during this PR creation step Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #270
47 lines
1.9 KiB
PHP
47 lines
1.9 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Filament\Resources\BaselineProfileResource;
|
|
use App\Models\BaselineProfile;
|
|
use App\Support\Baselines\BaselineProfileStatus;
|
|
use Filament\Facades\Filament;
|
|
|
|
it('keeps baseline profiles out of tenant panel registration and tenant navigation URLs', function (): void {
|
|
$tenantPanelResources = Filament::getPanel('tenant')->getResources();
|
|
|
|
expect($tenantPanelResources)->not->toContain(BaselineProfileResource::class);
|
|
|
|
[$user, $tenant] = createUserWithTenant(role: 'owner');
|
|
|
|
$this->actingAs($user)
|
|
->withSession([\App\Support\Workspaces\WorkspaceContext::SESSION_KEY => (int) $tenant->workspace_id])
|
|
->get("/admin/t/{$tenant->external_id}")
|
|
->assertOk()
|
|
->assertDontSee("/admin/t/{$tenant->external_id}/baseline-profiles", false)
|
|
->assertDontSee('>Baselines</span>', false);
|
|
});
|
|
|
|
it('keeps baseline profile urls workspace-owned even when a tenant context exists', function (): void {
|
|
[$user, $tenant] = createUserWithTenant(role: 'owner');
|
|
|
|
$profile = BaselineProfile::factory()->create([
|
|
'workspace_id' => (int) $tenant->workspace_id,
|
|
'status' => BaselineProfileStatus::Archived->value,
|
|
]);
|
|
|
|
$this->actingAs($user)
|
|
->withSession([\App\Support\Workspaces\WorkspaceContext::SESSION_KEY => (int) $tenant->workspace_id]);
|
|
|
|
$workspaceUrl = BaselineProfileResource::getUrl(panel: 'admin');
|
|
|
|
expect($workspaceUrl)->toContain('/admin/baseline-profiles');
|
|
expect($workspaceUrl)->not->toContain("/admin/t/{$tenant->external_id}/baseline-profiles");
|
|
|
|
$this->get($workspaceUrl)->assertOk();
|
|
$this->get(BaselineProfileResource::getUrl('view', ['record' => $profile], panel: 'admin'))->assertOk();
|
|
$this->get("/admin/t/{$tenant->external_id}/baseline-profiles")->assertNotFound();
|
|
|
|
expect($profile->fresh()->status)->toBe(BaselineProfileStatus::Archived);
|
|
});
|