Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
JobUpgradeTest.php
Go to the documentation of this file.
1 <?php
7 
9 
10 class JobUpgradeTest extends \PHPUnit\Framework\TestCase
11 {
12  public function testExecute()
13  {
14  $queue = $this->createMock(\Magento\Setup\Model\Cron\Queue::class);
15  $queue->expects($this->exactly(2))->method('addJobs');
16  $command = $this->createMock(\Magento\Setup\Console\Command\UpgradeCommand::class);
17  $command->expects($this->once())->method('run');
18  $status = $this->createMock(\Magento\Setup\Model\Cron\Status::class);
19  $output =
20  $this->getMockForAbstractClass(\Symfony\Component\Console\Output\OutputInterface::class, [], '', false);
22  $this->getMockForAbstractClass(\Magento\Framework\ObjectManagerInterface::class, [], '', false);
23  $objectManagerProvider =
24  $this->createPartialMock(\Magento\Setup\Model\ObjectManagerProvider::class, ['get']);
25  $objectManagerProvider->expects($this->once())->method('get')->willReturn($objectManager);
26 
27  $jobUpgrade = new JobUpgrade(
28  $command,
29  $objectManagerProvider,
30  $output,
31  $queue,
32  $status,
33  'setup:upgrade',
34  []
35  );
36  $jobUpgrade->execute();
37  }
38 }
$queue
Definition: queue.php:21
$objectManager
Definition: bootstrap.php:17
$status
Definition: order_status.php:8