public function testRead()
 {
     $configFiles = [file_get_contents(realpath(__DIR__ . '/_files/configA.xml')), file_get_contents(realpath(__DIR__ . '/_files/configB.xml'))];
     $this->_fileResolverMock->expects($this->any())->method('get')->will($this->returnValue($configFiles));
     $expectedResult = (require __DIR__ . '/_files/integration.php');
     $this->assertEquals($expectedResult, $this->_configReader->read(), 'Error happened during config reading.');
 }
Пример #2
0
 public function testGetIntegrationsFromConfigReader()
 {
     $integrations = ['foo', 'bar', 'baz'];
     $this->configCacheTypeMock->expects($this->once())->method('load')->with(Config::CACHE_ID)->will($this->returnValue(null));
     $this->configCacheTypeMock->expects($this->once())->method('save')->with(serialize($integrations), Config::CACHE_ID, [Type::CACHE_TAG])->will($this->returnValue(null));
     $this->configReaderMock->expects($this->once())->method('read')->will($this->returnValue($integrations));
     $this->assertEquals($integrations, $this->configModel->getIntegrations());
 }
Пример #3
0
 /**
  * Return integrations loaded from cache if enabled or from files merged previously
  *
  * @return array
  * @api
  */
 public function getIntegrations()
 {
     if (null === $this->_integrations) {
         $integrations = $this->_configCacheType->load(self::CACHE_ID);
         if ($integrations && is_string($integrations)) {
             $this->_integrations = unserialize($integrations);
         } else {
             $this->_integrations = $this->_configReader->read();
             $this->_configCacheType->save(serialize($this->_integrations), self::CACHE_ID, [Type::CACHE_TAG]);
         }
     }
     return $this->_integrations;
 }