Implements Spec 110 Ops‑UX Enforcement and applies the repo‑wide “enterprise” standard for operation start + dedup surfaces. Key points - Start surfaces: only ephemeral queued toast (no DB notifications for started/queued/running). - Dedup paths: canonical “already queued” toast. - Progress refresh: dispatch run-enqueued browser event so the global widget updates immediately. - Completion: exactly-once terminal DB notification on completion (per Ops‑UX contract). Tests & formatting - Full suite: 1738 passed, 8 skipped (8477 assertions). - Pint: `vendor/bin/sail bin pint --dirty --format agent` (pass). Notable change - Removed legacy `RunStatusChangedNotification` (replaced by the terminal-only completion notification policy). Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #134
30 lines
1.0 KiB
PHP
30 lines
1.0 KiB
PHP
<?php
|
||
|
||
declare(strict_types=1);
|
||
|
||
use App\Support\OpsUx\OperationUxPresenter;
|
||
|
||
it('builds canonical queued toast copy', function (): void {
|
||
$toast = OperationUxPresenter::queuedToast('policy.sync');
|
||
|
||
expect($toast->getTitle())->toBe('Policy sync queued');
|
||
expect($toast->getBody())->toBe('Running in the background.');
|
||
})->group('ops-ux');
|
||
|
||
it('enforces queued toast duration within 3–5 seconds', function (): void {
|
||
$toast = OperationUxPresenter::queuedToast('policy.sync');
|
||
|
||
$duration = $toast->getDuration();
|
||
|
||
expect($duration)->toBeInt();
|
||
expect($duration)->toBeGreaterThanOrEqual(3000);
|
||
expect($duration)->toBeLessThanOrEqual(5000);
|
||
})->group('ops-ux');
|
||
|
||
it('builds canonical already-queued toast copy', function (): void {
|
||
$toast = OperationUxPresenter::alreadyQueuedToast('backup_set.add_policies');
|
||
|
||
expect($toast->getTitle())->toBe('Backup set update already queued');
|
||
expect($toast->getBody())->toBe('A matching run is already queued or running.');
|
||
})->group('ops-ux');
|