/** * @param array $packageList * @param string $expectedVersion * @dataProvider testGetVersionGitInstallationDataProvider */ public function testGetVersion($packageList, $expectedVersion) { $this->composerInformationMock->expects($this->any())->method('getSystemPackages')->willReturn($packageList); $productVersion = $this->productMetadata->getVersion(); $this->assertNotEmpty($productVersion, 'Empty product version'); $this->assertEquals($expectedVersion, $productVersion); }
public function testGetVersion() { $productVersion = $this->productMetadata->getVersion(); $this->assertNotEmpty($productVersion, 'Empty product version'); preg_match('/^([0-9\\.]+)/', $productVersion, $matches); $this->assertArrayHasKey(1, $matches, 'Invalid product version'); $this->assertNotEmpty($matches, 'Empty product version'); }
/** * @return array|ViewModel */ public function indexAction() { $welcomeMsg = "Welcome to Magento Admin, your online store headquarters.<br>" . "Click 'Agree and Set Up Magento' or read "; $docRef = "http://devdocs.magento.com/guides/v1.0/install-gde/install/install-web.html"; $agreeButtonText = "Agree and Setup Magento"; $view = new ViewModel(); $view->setTerminal(true); $view->setTemplate('/magento/setup/landing.phtml'); $view->setVariable('version', $this->productMetadata->getVersion()); $view->setVariable('welcomeMsg', $welcomeMsg); $view->setVariable('docRef', $docRef); $view->setVariable('agreeButtonText', $agreeButtonText); return $view; }
/** * @param string $name application name * @param string $version application version * @SuppressWarnings(PHPMD.ExitExpression) */ public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN') { $this->serviceManager = \Zend\Mvc\Application::init(require BP . '/setup/config/application.config.php')->getServiceManager(); $generationDirectoryAccess = new GenerationDirectoryAccess($this->serviceManager); if (!$generationDirectoryAccess->check()) { $output = new ConsoleOutput(); $output->writeln('<error>Command line user does not have read and write permissions on var/generation directory. Please' . ' address this issue before using Magento command line.</error>'); exit(0); } /** * Temporary workaround until the compiler is able to clear the generation directory * @todo remove after MAGETWO-44493 resolved */ if (class_exists(CompilerPreparation::class)) { $compilerPreparation = new CompilerPreparation($this->serviceManager, new ArgvInput(), new File()); $compilerPreparation->handleCompilerEnvironment(); } if ($version == 'UNKNOWN') { $directoryList = new DirectoryList(BP); $composerJsonFinder = new ComposerJsonFinder($directoryList); $productMetadata = new ProductMetadata($composerJsonFinder); $version = $productMetadata->getVersion(); } parent::__construct($name, $version); }
/** * Return site specific information * * @return array */ public function getSiteDetails($storeId = null) { $edition = $this->productMetadata->getEdition(); $url = $this->storeManager->getStore($storeId)->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_LINK); $siteDetails = $this->siteDetailsFactory->create(['ecommerceCart' => 'Magento 2 ' . $edition, 'ecommerceVersion' => $this->productMetadata->getVersion(), 'websiteUrl' => $url, 'environmentScope' => $this->shipperDataHelper->getConfigValue('carriers/shipper/environment_scope', $storeId), 'appVersion' => $this->shipperDataHelper->getConfigValue('carriers/shipper/extension_version')]); return $siteDetails; }
/** * version information * * @return array */ public function getVersionInfo() { return ['product' => 'Magento2', 'productVersion' => $this->_productMetadata->getVersion(), 'pluginName' => $this->_pluginName, 'pluginVersion' => $this->_pluginVersion]; }