Skip to content

Commit

Permalink
magento/magento2 #23439 Fix-Unit-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
engcom-Foxtrot authored and ysapiga committed Jul 1, 2019
1 parent ff568ac commit 82d3b71
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,8 @@ public function testDispatchExceptionTooLate()
*/
public function testDispatchExceptionNoCallback()
{
$exceptionMessage = 'No callbacks found';
$jobCode = 'test_job1';
$exceptionMessage = sprintf('No callbacks found for cron job %s', $jobCode);
$exception = new \Exception(__($exceptionMessage));

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

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

$jobConfig = ['test_group' => ['test_job1' => ['instance' => 'Some_Class']]];
$jobConfig = ['test_group' => [$jobCode => ['instance' => 'Some_Class']]];

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

Expand Down

0 comments on commit 82d3b71

Please sign in to comment.