TenantAtlas/tests/Feature/078/LegacyRoutesReturnNotFoundTest.php
ahmido d56ba85755 Spec 078: Operations tenantless canonical detail (#95)
Implements Spec 078 operations tenantless canonical migration.

Highlights:
- Canonical run detail at `/admin/operations/{run}` renders with standard Filament chrome + sidebar and reuses `OperationRunResource::infolist()` (schema-based, Filament v5).
- Legacy tenant-scoped resource pages removed; legacy URLs return 404 as required.
- Added full spec test pack under `tests/Feature/078/` and updated existing tests.
- Added safe refresh/header actions wiring and KPI header guard when tenant context is null.

Validation:
- `vendor/bin/sail artisan test --compact tests/Feature/078/` (pass)
- `vendor/bin/sail bin pint --dirty` (pass)

Notes:
- Livewire v4+ compliant (Filament v5).
- Panel providers remain registered in `bootstrap/providers.php` (Laravel 11+ standard).

Co-authored-by: Ahmed Darrazi <ahmeddarrazi@MacBookPro.fritz.box>
Reviewed-on: #95
2026-02-07 09:07:26 +00:00

43 lines
1.3 KiB
PHP

<?php
declare(strict_types=1);
use App\Models\OperationRun;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Route;
use Tests\TestCase;
final class LegacyRoutesReturnNotFoundTest extends TestCase
{
use RefreshDatabase;
public function test_returns_404_for_legacy_tenant_scoped_operation_detail_urls(): void
{
[$user, $tenant] = createUserWithTenant(role: 'owner');
$run = OperationRun::factory()->create([
'workspace_id' => (int) $tenant->workspace_id,
'tenant_id' => (int) $tenant->getKey(),
]);
$this->actingAs($user)
->get('/admin/t/'.$tenant->external_id.'/operations/r/'.$run->getKey())
->assertNotFound();
}
public function test_returns_404_for_the_admin_operations_r_record_legacy_slug_variant(): void
{
[$user] = createUserWithTenant(role: 'owner');
$this->actingAs($user)
->get('/admin/operations/r/123')
->assertNotFound();
}
public function test_does_not_register_legacy_operation_resource_route_names(): void
{
$this->assertFalse(Route::has('filament.admin.resources.operations.view'));
$this->assertFalse(Route::has('filament.admin.resources.operations.index'));
}
}