/**
  * Load primary config
  *
  * @param DirectoryList $directoryList
  * @param DriverPool $driverPool
  * @param mixed $argumentMapper
  * @param string $appMode
  * @return array
  * @throws \Magento\Framework\Exception\State\InitException
  */
 protected function _loadPrimaryConfig(DirectoryList $directoryList, $driverPool, $argumentMapper, $appMode)
 {
     $configData = null;
     try {
         $fileResolver = new \Magento\Framework\App\Arguments\FileResolver\Primary(new \Magento\Framework\Filesystem($directoryList, new \Magento\Framework\Filesystem\Directory\ReadFactory($driverPool), new \Magento\Framework\Filesystem\Directory\WriteFactory($driverPool)), new \Magento\Framework\Config\FileIteratorFactory(new \Magento\Framework\Filesystem\File\ReadFactory(new \Magento\Framework\Filesystem\DriverPool())));
         $schemaLocator = new \Magento\Framework\ObjectManager\Config\SchemaLocator();
         $validationState = new \Magento\Framework\App\Arguments\ValidationState($appMode);
         $reader = new \Magento\Framework\ObjectManager\Config\Reader\Dom($fileResolver, $argumentMapper, $schemaLocator, $validationState);
         $configData = $reader->read('primary');
     } catch (\Exception $e) {
         throw new \Magento\Framework\Exception\State\InitException(new \Magento\Framework\Phrase($e->getMessage()), $e);
     }
     return $configData;
 }
예제 #2
0
 public function testRead()
 {
     $model = new \Magento\Framework\ObjectManager\Config\Reader\Dom($this->_fileResolverMock, $this->_mapper, $this->_schemaLocator, $this->_validationState);
     $this->assertEquals($this->_mapper->convert($this->_mergedConfig), $model->read('scope'));
 }