Beispiel #1
0
 /**
  * Search for minified file provided along with the original file in the code base
  *
  * @param string $originalFile
  * @return bool|string
  */
 protected function _findOriginalMinifiedFile($originalFile)
 {
     $fileInfo = pathinfo($originalFile);
     $minifiedFile = $fileInfo['dirname'] . '/' . $fileInfo['filename'] . '.min.' . $fileInfo['extension'];
     if ($this->rootDirectory->isExist($minifiedFile)) {
         return $minifiedFile;
     }
     return false;
 }
Beispiel #2
0
 /**
  * Retrieve data from file
  *
  * @param string $file
  * @return array
  */
 protected function _getFileData($file)
 {
     $data = [];
     if ($this->directory->isExist($this->directory->getRelativePath($file))) {
         $this->_csvParser->setDelimiter(',');
         $data = $this->_csvParser->getDataPairs($file);
     }
     return $data;
 }
Beispiel #3
0
 /**
  * Go through all modules and find configuration files of active modules
  *
  * @param string $filename
  * @return FileIterator
  */
 public function getConfigurationFiles($filename)
 {
     $result = array();
     foreach (array_keys($this->modulesList->getModules()) as $moduleName) {
         $file = $this->getModuleDir('etc', $moduleName) . '/' . $filename;
         $path = $this->modulesDirectory->getRelativePath($file);
         if ($this->modulesDirectory->isExist($path)) {
             $result[] = $path;
         }
     }
     return $this->fileIteratorFactory->create($this->modulesDirectory, $result);
 }
Beispiel #4
0
 /**
  * Go through all modules and find composer.json files of active modules
  *
  * @return FileIterator
  */
 public function getComposerJsonFiles()
 {
     $result = [];
     foreach ($this->modulesList->getNames() as $moduleName) {
         $file = $this->getModuleDir('', $moduleName) . '/composer.json';
         $path = $this->modulesDirectory->getRelativePath($file);
         if ($this->modulesDirectory->isExist($path)) {
             $result[] = $path;
         }
     }
     return $this->fileIteratorFactory->create($this->modulesDirectory, $result);
 }
 /**
  * Return default path related data
  *
  * @param string $configPath
  * @return array
  */
 protected function _preparePathData($configPath)
 {
     $themeDirectory = dirname($configPath);
     if ($this->_directory->isExist($themeDirectory)) {
         $fullPath = $this->_directory->getRelativePath($themeDirectory);
         $pathPieces = explode('/', $fullPath);
         $area = array_shift($pathPieces);
         return ['area' => $area, 'theme_path_pieces' => $pathPieces];
     } else {
         $fullPath = $this->rootDirectory->getRelativePath($themeDirectory);
         return $this->themeDirs->getAreaConfiguration($fullPath);
     }
 }
Beispiel #6
0
 /**
  * Install application
  *
  * @param \Magento\Install\Model\Installer\Console $installer
  * @return void
  */
 protected function _handleInstall(\Magento\Install\Model\Installer\Console $installer)
 {
     if (isset($this->_arguments['config']) && $this->rootDirectory->isExist($this->rootDirectory->getRelativePath($this->_arguments['config']))) {
         $config = (array) (include $this->_arguments['config']);
         $this->_arguments = array_merge((array) $config, $this->_arguments);
     }
     $result = $installer->install($this->_arguments);
     if (!$installer->hasErrors()) {
         $msg = 'Installed successfully' . ($result ? ' (encryption key "' . $result . '")' : '');
         $this->_output->success($msg . PHP_EOL);
     } else {
         $this->_output->error(implode(PHP_EOL, $installer->getErrors()) . PHP_EOL);
     }
 }
Beispiel #7
0
 public function testIsExist()
 {
     $this->driver->expects($this->once())->method('isExists')->will($this->returnValue(true));
     $this->assertTrue($this->read->isExist('correct-path'));
 }
 /**
  * Check robots.txt file changed when robots.txt exists
  *
  * @magentoDataFixture Magento/Config/Model/_files/robots_txt.php
  * @magentoDbIsolation enabled
  */
 public function testAfterSaveFileExists()
 {
     $this->assertTrue($this->rootDirectory->isExist('robots.txt'), 'robots.txt not exists');
     $this->_modifyConfig();
 }
 /**
  * Return configuration model for themes
  *
  * @param string $configPath
  * @return \Magento\Framework\Config\Theme
  */
 protected function _getConfigModel($configPath)
 {
     $relativeConfigPath = $this->_directory->getRelativePath($configPath);
     $configContent = $this->_directory->isExist($relativeConfigPath) ? $this->_directory->readFile($relativeConfigPath) : null;
     return $this->themeConfigFactory->create(['configContent' => $configContent]);
 }