public function testGetAvailableVersions()
 {
     $package = 'magento/product-community-edition';
     $actualVersions = $this->composerManager->getAvailableVersions($package);
     $this->assertNotEmpty($actualVersions);
     $this->assertContains('dev-master', $actualVersions);
 }
 /**
  * {@inheritdoc}
  */
 public function execute()
 {
     $this->maintenanceMode->set(true);
     $this->backup->execute();
     try {
         $this->status->add('Starting composer update...');
         foreach ($this->params as $directive => $params) {
             $this->composerManager->updateComposerConfigFile($directive, $params);
         }
         $this->composerManager->runUpdate();
         $this->status->setUpdateError(false);
         $this->maintenanceMode->set(false);
         $this->status->add('Composer update completed successfully');
     } catch (\Exception $e) {
         $this->status->setUpdateError(true);
         try {
             $this->rollback->execute();
             $this->status->setUpdateError(false);
             $this->maintenanceMode->set(false);
         } catch (\Exception $e) {
             throw new \RuntimeException(sprintf('Could not complete %s successfully: %s', $this, $e->getMessage()));
         }
         throw new \RuntimeException(sprintf('Could not complete %s successfully: %s', $this, $e->getMessage()));
     }
     $this->flushMagentoCache();
     return $this;
 }
 protected function setUp()
 {
     $this->versions = ['dev-master', '0.74.0-beta3', '0.74.0-beta2', '0.74.0-beta1'];
     $this->composerManagerMock = $this->getMockBuilder('Magento\\Update\\Queue\\JobUpdate\\ComposerManager')->setMethods(['getAvailableVersions'])->disableOriginalConstructor()->getMock();
     $this->composerManagerMock->expects($this->once())->method('getAvailableVersions')->willReturn($this->versions);
     $this->versionCheck = new \Magento\Update\VersionCheck(null, null, $this->composerManagerMock);
 }
 /**
  * Retrieve all available versions for a package
  *
  * @return array
  */
 public function getAvailableVersions()
 {
     $this->availableVersions = $this->composerManager->getAvailableVersions($this->package);
     return $this->availableVersions;
 }