Esempio n. 1
0
 public function testGetScopeSwitchingWithCachedData()
 {
     $testValue = ['some' => 'testValue'];
     /** change current area */
     $this->_configScopeMock->expects($this->any())->method('getCurrentScope')->will($this->returnValue('adminhtml'));
     /** set cache data */
     $this->_cacheMock->expects($this->once())->method('load')->with('adminhtml::tag')->will($this->returnValue(serialize($testValue)));
     /** test preventing of getting data from reader  */
     $this->_readerMock->expects($this->never())->method('read');
     /** test preventing of cache saving  */
     $this->_cacheMock->expects($this->never())->method('save');
     /** test config value existence */
     $this->assertEquals('testValue', $this->_model->get('some'));
     /** test preventing of double config data loading from reader */
     $this->assertEquals('testValue', $this->_model->get('some'));
 }
Esempio n. 2
0
 /**
  * Merge additional config
  *
  * @param array $config
  * @return void
  */
 public function merge(array $config)
 {
     if (isset($config['config']['system'])) {
         $config = $config['config']['system'];
     }
     parent::merge($config);
 }
Esempio n. 3
0
 /**
  * Get config value by key
  *
  * @param null|string $path
  * @param null|mixed $default
  * @return null|mixed
  */
 public function get($path = null, $default = null)
 {
     if (!$this->_appState->isInstalled() && !in_array($this->_configScope->getCurrentScope(), array('global', 'install'))) {
         return $default;
     }
     return parent::get($path, $default);
 }
Esempio n. 4
0
 /**
  * @param ReaderInterface $reader
  * @param ScopeInterface $configScope
  * @param CacheInterface $cache
  * @param RelationsInterface $relations
  * @param ConfigInterface $omConfig
  * @param DefinitionInterface $definitions
  * @param ObjectManagerInterface $objectManager
  * @param ClassDefinitions $classDefinitions
  * @param array $scopePriorityScheme
  * @param string $cacheId
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function __construct(ReaderInterface $reader, ScopeInterface $configScope, CacheInterface $cache, RelationsInterface $relations, ConfigInterface $omConfig, DefinitionInterface $definitions, ObjectManagerInterface $objectManager, ClassDefinitions $classDefinitions, array $scopePriorityScheme = ['global'], $cacheId = 'plugins')
 {
     parent::__construct($reader, $configScope, $cache, $cacheId);
     $this->_omConfig = $omConfig;
     $this->_relations = $relations;
     $this->_definitions = $definitions;
     $this->_classDefinitions = $classDefinitions;
     $this->_scopePriorityScheme = $scopePriorityScheme;
     $this->_objectManager = $objectManager;
 }
Esempio n. 5
0
 /**
  * @param Config\Reader $reader
  * @param \Magento\Framework\Config\ScopeInterface $configScope
  * @param \Magento\Framework\Config\CacheInterface $cache
  * @param \Magento\Framework\App\DeploymentConfig $deploymentConfig
  * @param string $cacheId
  * @throws \InvalidArgumentException
  */
 public function __construct(Config\Reader $reader, \Magento\Framework\Config\ScopeInterface $configScope, \Magento\Framework\Config\CacheInterface $cache, \Magento\Framework\App\DeploymentConfig $deploymentConfig, $cacheId = 'resourcesCache')
 {
     parent::__construct($reader, $configScope, $cache, $cacheId);
     foreach ($deploymentConfig->getConfigData(ConfigOptionsList::KEY_RESOURCE) as $resourceName => $resourceData) {
         if (!isset($resourceData['connection'])) {
             throw new \InvalidArgumentException('Invalid initial resource configuration');
         }
         $this->_connectionNames[$resourceName] = $resourceData['connection'];
     }
 }
Esempio n. 6
0
 /**
  * @param Config\Reader $reader
  * @param \Magento\Framework\Config\ScopeInterface $configScope
  * @param \Magento\Framework\Config\CacheInterface $cache
  * @param string $cacheId
  * @param array $initialResources
  * @throws \InvalidArgumentException
  */
 public function __construct(Config\Reader $reader, \Magento\Framework\Config\ScopeInterface $configScope, \Magento\Framework\Config\CacheInterface $cache, $cacheId = 'resourcesCache', $initialResources = array())
 {
     parent::__construct($reader, $configScope, $cache, $cacheId);
     foreach ($initialResources as $resourceName => $resourceData) {
         if (!isset($resourceData['connection'])) {
             throw new \InvalidArgumentException('Invalid initial resource configuration');
         }
         $this->_connectionNames[$resourceName] = $resourceData['connection'];
     }
 }
Esempio n. 7
0
 /**
  * @param \Magento\Framework\Cache\Config\Reader $reader
  * @param \Magento\Framework\Config\ScopeInterface $configScope
  * @param \Magento\Framework\Config\CacheInterface $cache
  * @param string $cacheId
  */
 public function __construct(\Magento\Framework\Cache\Config\Reader $reader, \Magento\Framework\Config\ScopeInterface $configScope, \Magento\Framework\Config\CacheInterface $cache, $cacheId)
 {
     parent::__construct($reader, $configScope, $cache, $cacheId);
 }
Esempio n. 8
0
 /**
  * @param \Magento\Index\Model\Indexer\Config\Reader $reader
  * @param \Magento\Framework\Config\ScopeInterface $configScope
  * @param \Magento\Framework\Config\CacheInterface $cache
  * @param string $cacheId
  */
 public function __construct(\Magento\Index\Model\Indexer\Config\Reader $reader, \Magento\Framework\Config\ScopeInterface $configScope, \Magento\Framework\Config\CacheInterface $cache, $cacheId = 'indexerConfigCache')
 {
     parent::__construct($reader, $configScope, $cache, $cacheId);
 }
Esempio n. 9
0
 /**
  * @param Reader $reader
  * @param ScopeInterface $configScope
  * @param CacheInterface $cache
  * @param string $cacheId
  */
 public function __construct(Reader $reader, ScopeInterface $configScope, CacheInterface $cache, $cacheId = 'sample_config_cache')
 {
     parent::__construct($reader, $configScope, $cache, $cacheId);
 }