Beispiel #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'));
 }
Beispiel #2
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);
 }