11 use PHPUnit_Framework_MockObject_MockObject as MockObject;
12 use Symfony\Component\Console\Tester\CommandTester;
19 private $objectManagerFactory;
24 private $deploymentConfigMock;
28 $this->objectManagerFactory = $this->createMock(ObjectManagerFactory::class);
29 $this->deploymentConfigMock = $this->createMock(DeploymentConfig::class);
39 $this->objectManagerFactory->expects($this->never())
41 $this->deploymentConfigMock->expects($this->once())
43 ->with(
'cron/enabled', 1)
45 $commandTester =
new CommandTester(
46 new CronCommand($this->objectManagerFactory, $this->deploymentConfigMock)
48 $commandTester->execute([]);
49 $expectedMsg =
'Cron is disabled. Jobs were not run.' . PHP_EOL;
50 $this->assertEquals($expectedMsg, $commandTester->getDisplay());
61 $cron = $this->createMock(\
Magento\Framework\
App\Cron::class);
65 $cron->expects($this->once())
67 $this->objectManagerFactory->expects($this->once())
70 $this->deploymentConfigMock->expects($this->once())
72 ->with(
'cron/enabled', 1)
74 $commandTester =
new CommandTester(
75 new CronCommand($this->objectManagerFactory, $this->deploymentConfigMock)
77 $commandTester->execute([]);
78 $expectedMsg =
'Ran jobs by schedule.' . PHP_EOL;
79 $this->assertEquals($expectedMsg, $commandTester->getDisplay());
testExecuteWithDisabledCrons()