TenantAtlas/apps/platform/tests/Feature/OpsUx/CanonicalViewRunLinksTest.php
ahmido be314c577f Spec 400: rebuild Tenantial homepage visuals (#387)
## Summary
- rebuild the public Tenantial homepage around an evidence-first Microsoft tenant governance narrative
- replace the old hero visual with a new static dashboard preview and add dedicated Trust Bar and Feature Pillars sections
- update the shared public shell, navigation, footer, dark design tokens, assets, and homepage content to match the new brand direction
- align website smoke coverage and Spec 400 artifacts with the rebuilt homepage

## Testing
- not run in this pass
- updated website smoke specs under apps/website/tests/smoke

## Note
- `website-dev` was pushed to `origin` so the requested PR base exists remotely
- the remote `website-dev` branch is an ancestor of `origin/dev`, so this PR may also show upstream `dev` history relative to that base

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #387
2026-05-18 14:38:11 +00:00

122 lines
4.8 KiB
PHP

<?php
declare(strict_types=1);
use App\Models\OperationRun;
use App\Models\Tenant;
use App\Support\OperationRunLinks;
use App\Support\OpsUx\OperationRunUrl;
use App\Support\System\SystemOperationRunLinks;
use Illuminate\Support\Facades\File;
it('routes all OperationRun view links through OperationRunLinks', function (): void {
$files = File::allFiles(app_path());
$violations = [];
foreach ($files as $file) {
$path = $file->getRealPath();
if (! is_string($path)) {
continue;
}
// OperationRunLinks is the canonical wrapper.
if (str_ends_with($path, '/Support/OperationRunLinks.php')) {
continue;
}
$contents = File::get($path);
if (preg_match("/\\bOperationRunResource::getUrl\(\\s*'view'/", $contents) === 1
|| preg_match("/route\(\s*'filament\.admin\.resources\.operations\.view'/", $contents) === 1) {
$violations[] = $path;
}
}
expect($violations)->toBeEmpty();
})->group('ops-ux');
it('resolves tenantless operation run links to the canonical admin.operations.view route', function (): void {
$run = OperationRun::factory()->create();
$expectedUrl = route('admin.operations.view', ['run' => (int) $run->getKey()]);
expect(OperationRunLinks::tenantlessView($run))->toBe($expectedUrl);
expect(OperationRunLinks::tenantlessView((int) $run->getKey()))->toBe($expectedUrl);
})->group('ops-ux');
it('normalizes tenant-scoped callers onto the canonical tenantless run route', function (): void {
$tenant = Tenant::factory()->create();
$run = OperationRun::factory()->for($tenant)->create();
$expectedUrl = route('admin.operations.view', ['run' => (int) $run->getKey()]);
expect(OperationRunLinks::view($run, $tenant))->toBe($expectedUrl)
->and(OperationRunLinks::view((int) $run->getKey(), $tenant))->toBe($expectedUrl);
})->group('ops-ux');
it('preserves tenant prefilter, requested tab, and problem class on canonical operations collection links', function (): void {
$tenant = Tenant::factory()->create();
expect(OperationRunLinks::index($tenant, activeTab: 'active'))
->toBe(route('admin.operations.index', [
'tenant_id' => (int) $tenant->getKey(),
'activeTab' => 'active',
]))
->and(OperationRunLinks::index(
$tenant,
activeTab: OperationRun::PROBLEM_CLASS_ACTIVE_STALE_ATTENTION,
problemClass: OperationRun::PROBLEM_CLASS_ACTIVE_STALE_ATTENTION,
))
->toBe(route('admin.operations.index', [
'tenant_id' => (int) $tenant->getKey(),
'activeTab' => OperationRun::PROBLEM_CLASS_ACTIVE_STALE_ATTENTION,
'problemClass' => OperationRun::PROBLEM_CLASS_ACTIVE_STALE_ATTENTION,
]))
->and(OperationRunLinks::index(
$tenant,
activeTab: OperationRun::PROBLEM_CLASS_TERMINAL_FOLLOW_UP,
problemClass: OperationRun::PROBLEM_CLASS_TERMINAL_FOLLOW_UP,
))
->toBe(route('admin.operations.index', [
'tenant_id' => (int) $tenant->getKey(),
'activeTab' => OperationRun::PROBLEM_CLASS_TERMINAL_FOLLOW_UP,
'problemClass' => OperationRun::PROBLEM_CLASS_TERMINAL_FOLLOW_UP,
]));
})->group('ops-ux');
it('preserves helper-owned operation type filters on canonical operations collection links', function (): void {
$tenant = Tenant::factory()->create();
expect(OperationRunLinks::index($tenant, operationType: 'inventory_sync'))
->toBe(route('admin.operations.index', [
'tenant_id' => (int) $tenant->getKey(),
'tableFilters' => [
'type' => [
'value' => 'inventory.sync',
],
],
]));
})->group('ops-ux');
it('keeps the thin operation URL delegate on the canonical admin helpers', function (): void {
$tenant = Tenant::factory()->create();
$run = OperationRun::factory()->for($tenant)->create();
expect(OperationRunUrl::view($run, $tenant))
->toBe(OperationRunLinks::view($run, $tenant))
->and(OperationRunUrl::index($tenant))
->toBe(OperationRunLinks::index($tenant));
})->group('ops-ux');
it('resolves system operation links through the canonical system helper family', function (): void {
$run = OperationRun::factory()->create();
expect(SystemOperationRunLinks::index())
->toBe(\App\Filament\System\Pages\Ops\Runs::getUrl(panel: 'system'))
->and(SystemOperationRunLinks::view($run))
->toBe(\App\Filament\System\Pages\Ops\ViewRun::getUrl(['run' => (int) $run->getKey()], panel: 'system'))
->and(SystemOperationRunLinks::view((int) $run->getKey()))
->toBe(\App\Filament\System\Pages\Ops\ViewRun::getUrl(['run' => (int) $run->getKey()], panel: 'system'));
})->group('ops-ux');