Skip to content

Commit 82d3b71

Browse files
engcom-Foxtrotysapiga
authored andcommitted
magento/magento2 #23439 Fix-Unit-tests
1 parent ff568ac commit 82d3b71

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

app/code/Magento/Cron/Test/Unit/Observer/ProcessCronQueueObserverTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,8 @@ public function testDispatchExceptionTooLate()
354354
*/
355355
public function testDispatchExceptionNoCallback()
356356
{
357-
$exceptionMessage = 'No callbacks found';
357+
$jobCode = 'test_job1';
358+
$exceptionMessage = sprintf('No callbacks found for cron job %s', $jobCode);
358359
$exception = new \Exception(__($exceptionMessage));
359360

360361
$dateScheduledAt = date('Y-m-d H:i:s', $this->time - 86400);
@@ -363,7 +364,7 @@ public function testDispatchExceptionNoCallback()
363364
)->setMethods(
364365
['getJobCode', 'tryLockJob', 'getScheduledAt', 'save', 'setStatus', 'setMessages', '__wakeup', 'getStatus']
365366
)->disableOriginalConstructor()->getMock();
366-
$schedule->expects($this->any())->method('getJobCode')->will($this->returnValue('test_job1'));
367+
$schedule->expects($this->any())->method('getJobCode')->will($this->returnValue($jobCode));
367368
$schedule->expects($this->once())->method('getScheduledAt')->will($this->returnValue($dateScheduledAt));
368369
$schedule->expects($this->once())->method('tryLockJob')->will($this->returnValue(true));
369370
$schedule->expects(
@@ -383,7 +384,7 @@ public function testDispatchExceptionNoCallback()
383384

384385
$this->loggerMock->expects($this->once())->method('critical')->with($exception);
385386

386-
$jobConfig = ['test_group' => ['test_job1' => ['instance' => 'Some_Class']]];
387+
$jobConfig = ['test_group' => [$jobCode => ['instance' => 'Some_Class']]];
387388

388389
$this->_config->expects($this->exactly(2))->method('getJobs')->will($this->returnValue($jobConfig));
389390

0 commit comments

Comments
 (0)