diff --git a/packages/cron-job/Tests/CronJobProcessorTest.php b/packages/cron-job/Tests/CronJobProcessorTest.php index e93ba57b..e8285747 100644 --- a/packages/cron-job/Tests/CronJobProcessorTest.php +++ b/packages/cron-job/Tests/CronJobProcessorTest.php @@ -104,13 +104,21 @@ public function testProcess( ?string $overwrittenCommand, string $expectedProcessCommand ): void { + $returnedPreCronJobExecutionEvent = new PreCronJobExecutionEvent( + $execution = $this->createCronJobExecution($command) + ); + + if (null !== $overwrittenCommand) { + $returnedPreCronJobExecutionEvent->setCommand($overwrittenCommand); + } + $this->eventDispatcher ->expects(static::exactly(2)) ->method('dispatch') ->with( ...static::withConsecutive( [ - new PreCronJobExecutionEvent($execution = $this->createCronJobExecution($command)), + new PreCronJobExecutionEvent($execution), ], [ $postExecutionEvent = new PostCronJobExecutionEvent($execution), @@ -118,7 +126,7 @@ public function testProcess( ) ) ->willReturnOnConsecutiveCalls( - new PreCronJobExecutionEvent($execution, command: $overwrittenCommand), + $returnedPreCronJobExecutionEvent, $postExecutionEvent );