コード例 #1
0
 /**
  * @expectedException \RuntimeException
  * @expectedExceptionMessage Cannot find component to update
  */
 public function testExecuteNoRequire()
 {
     $om = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
     $jobUpdate = $om->create('Magento\\Update\\Queue\\JobUpdate', ['composerApp' => $this->composerApp, 'status' => $this->status, 'params' => [], 'queue' => $this->queue, 'name' => 'setup:upgrade']);
     $this->composerApp->expects($this->never())->method('runComposerCommand');
     $this->queue->expects($this->never())->method('addJobs');
     $jobUpdate->execute();
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function execute()
 {
     try {
         $this->status->add('Starting composer remove...');
         if (isset($this->params['components'])) {
             $packages = [];
             foreach ($this->params['components'] as $compObj) {
                 $packages[] = $compObj['name'];
             }
             $this->status->add($this->composerApp->runComposerCommand(['command' => 'remove', 'packages' => $packages, '--no-update' => true]));
         } else {
             throw new \RuntimeException('Cannot find component to uninstall');
         }
         $this->status->add($this->composerApp->runComposerCommand(['command' => 'update']));
         $this->status->add('Composer remove completed successfully');
         $this->queue->addJobs([['name' => \Magento\Update\Queue\JobFactory::NAME_MAINTENANCE_MODE, 'params' => ['enable' => false]]]);
     } catch (\Exception $e) {
         $this->status->setUpdateError(true);
         throw new \RuntimeException(sprintf('Could not complete %s successfully: %s', $this, $e->getMessage()));
     }
     return $this;
 }
コード例 #3
0
 /**
  * @dataProvider popQueueJobInvalidQueueFormatProvider
  * @param string $queueJson
  * @param string $expectedExceptionMessage
  */
 public function testPopQueueJobInvalidQueueFormat($queueJson, $expectedExceptionMessage)
 {
     $this->setExpectedException('\\RuntimeException', $expectedExceptionMessage);
     $this->queueReaderMock->expects($this->once())->method('read')->willReturn($queueJson);
     $this->queue->popQueuedJobs();
 }
コード例 #4
0
 /**
  * Create setup:upgrade task for setup application cron
  *
  * @return void
  */
 private function createSetupUpgradeTasks()
 {
     $jobs = [['name' => 'setup:upgrade', 'params' => []]];
     $this->queue->addJobs($jobs);
 }
コード例 #5
0
 /**
  * @expectedException \RuntimeException
  * @expectedExceptionMessage field is missing for one or more jobs
  */
 public function testAddJobsInvalidJobs()
 {
     $this->queue->addJobs([['no_name' => 'no job', 'no_params' => []]]);
 }