/**
  * @expectedException \RuntimeException
  * @expectedExceptionMessage Exception
  */
 public function testExecuteException()
 {
     $om = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
     $jobUpdate = $om->create('Magento\\Update\\Queue\\JobUpdate', ['composerApp' => $this->composerApp, 'status' => $this->status, 'params' => ['components' => [['name' => 'vendor/package', 'version' => '1.0']]], 'queue' => $this->queue, 'name' => 'setup:upgrade']);
     $this->status->expects($this->atLeastOnce())->method('add');
     $this->composerApp->expects($this->at(0))->method('runComposerCommand')->with(['command' => 'require', 'packages' => ['vendor/package 1.0'], '--no-update' => true])->willReturn('Success');
     $this->composerApp->expects($this->at(1))->method('runComposerCommand')->with(['command' => 'update'])->will($this->throwException(new \Exception('Exception')));
     $this->status->expects($this->once())->method('setUpdateError')->with(true);
     $jobUpdate->execute();
 }
 /**
  * @expectedException \RuntimeException
  * @expectedExceptionMessage
  */
 public function testRunException()
 {
     $this->application->expects($this->at(1))->method('runComposerCommand')->willThrowException(new \RuntimeException($this->errorMessage));
     $this->infoCommand->expects($this->once())->method('run')->willReturn($this->packageInfo);
     $this->requireUpdateDryRunCommand->run(['3rdp/e 1.2.0'], '');
 }
Exemple #3
0
 public function testRunInstalled()
 {
     $this->application->expects($this->once())->method('runComposerCommand')->willReturn($this->installedOutput);
     $result = $this->infoCommand->run('3rdp/a', true);
     $this->assertEquals(['name' => '3rdp/a', 'descrip.' => 'Plugin project A', 'versions' => '* 1.0.0', 'keywords' => '', 'type' => 'library', 'names' => '3rdp/a', 'current_version' => '1.0.0', 'available_versions' => [], 'new_versions' => []], $result);
 }