ensureRun( tenant: $tenant, type: 'test.release', inputs: ['foo' => 'bar'], initiator: $user, ); $job = new class($operationRun) implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; public function __construct(public OperationRun $operationRun) { $this->withFakeQueueInteractions(); } }; $middleware = new TrackOperationRun; $middleware->handle($job, function ($job): void { $job->release(60); }); $operationRun->refresh(); expect($operationRun->status)->toBe('running'); expect($operationRun->outcome)->toBe('pending'); });