/** * Search for magento root folder * * @param InputInterface|null $input [optional] * @param OutputInterface|null $output [optional] * @return void */ public function detectMagento(InputInterface $input = null, OutputInterface $output = null) { // do not detect magento twice if ($this->_magentoDetected) { return; } if ($this->getMagentoRootFolder() === null) { $this->_checkRootDirOption(); $folder = OperatingSystem::getCwd(); } else { $folder = $this->getMagentoRootFolder(); } $this->getHelperSet()->set(new MagentoHelper($input, $output), 'magento'); $magentoHelper = $this->getHelperSet()->get('magento'); /* @var $magentoHelper MagentoHelper */ if (!$this->_directRootDir) { $subFolders = $this->config->getDetectSubFolders(); } else { $subFolders = array(); } $this->_magentoDetected = $magentoHelper->detect($folder, $subFolders); $this->_magentoRootFolder = $magentoHelper->getRootFolder(); $this->_magentoEnterprise = $magentoHelper->isEnterpriseEdition(); $this->_magentoMajorVersion = $magentoHelper->getMajorVersion(); $this->_magerunStopFileFound = $magentoHelper->isMagerunStopFileFound(); $this->_magerunStopFileFolder = $magentoHelper->getMagerunStopFileFolder(); }
/** * Search for magento root folder * * @param InputInterface $input [optional] * @param OutputInterface $output [optional] */ public function detectMagento(InputInterface $input = null, OutputInterface $output = null) { // do not detect magento twice if ($this->_magentoDetected) { return; } if ($this->getMagentoRootFolder() === null) { $this->_checkRootDirOption(); if (function_exists('exec')) { if (OperatingSystem::isWindows()) { $folder = exec('@echo %cd%'); // @TODO not currently tested!!! } else { $folder = exec('pwd'); } } else { $folder = getcwd(); } } else { $folder = $this->getMagentoRootFolder(); } $this->getHelperSet()->set(new MagentoHelper($input, $output), 'magento'); $magentoHelper = $this->getHelperSet()->get('magento'); /* @var $magentoHelper MagentoHelper */ if (!$this->_directRootDir) { $subFolders = $this->config->getDetectSubFolders(); } else { $subFolders = array(); } $this->_magentoDetected = $magentoHelper->detect($folder, $subFolders); $this->_magentoRootFolder = $magentoHelper->getRootFolder(); $this->_magentoEnterprise = $magentoHelper->isEnterpriseEdition(); $this->_magentoMajorVersion = $magentoHelper->getMajorVersion(); $this->_magerunStopFileFound = $magentoHelper->isMagerunStopFileFound(); $this->_magerunStopFileFolder = $magentoHelper->getMagerunStopFileFolder(); }
/** * @test */ public function loadPartialConfig() { $config = new Config(); $this->assertEquals(array(), $config->getDetectSubFolders()); $config->loadPartialConfig(false); $actual = $config->getDetectSubFolders(); $this->assertInternalType('array', $actual); $this->assertNotEquals(array(), $actual); }