TenantAtlas/tests/Feature/BackupScheduling/RunBackupScheduleJobCompatibilityTest.php
ahmido 5770c7b76b Spec 092: Legacy Purge (runs/routes/UI/test shims) (#110)
Implements Spec 092 legacy purge.

Key changes:
- Remove legacy Inventory landing page + view; link Inventory entry directly to Inventory Items.
- Update Drift landing copy to "operation runs"; remove URL heuristic from context bar.
- Remove legacy redirect shim route and assert 404 for old bookmarks.
- Staged job payload change: remove legacy ctor arg; keep legacy field for deserialization compatibility; new payload omits field.
- Remove legacy notification artifact.
- Remove legacy test shim + update tests; strengthen guard suite with scoped exception for job compat field.
- Add spec/plan/tasks/checklist artifacts under specs/092-legacy-purge-final.

Tests:
- Focused Pest suite for guards, legacy routes, redirect behavior, job compatibility, drift copy.
- Pint run: `vendor/bin/sail bin pint --dirty`.

Notes:
- Deploy B final removal of `backupScheduleRunId` should occur only after the compatibility window defined in the spec.

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #110
2026-02-14 18:43:56 +00:00

24 lines
803 B
PHP

<?php
use App\Jobs\RunBackupScheduleJob;
it('serializes without the legacy backup schedule run id field', function (): void {
$job = new RunBackupScheduleJob(operationRun: null, backupScheduleId: 42);
expect(serialize($job))->not->toContain('backupScheduleRunId');
});
it('can deserialize legacy payloads that still contain backupScheduleRunId', function (): void {
$class = RunBackupScheduleJob::class;
$payload = sprintf(
'O:%d:"%s":3:{s:19:"backupScheduleRunId";i:0;s:12:"operationRun";N;s:16:"backupScheduleId";i:42;}',
strlen($class),
$class
);
$job = unserialize($payload, ['allowed_classes' => [RunBackupScheduleJob::class]]);
expect($job)->toBeInstanceOf(RunBackupScheduleJob::class)
->and($job->backupScheduleId)->toBe(42);
});