public function testRead()
 {
     $configFiles = [file_get_contents(realpath(__DIR__ . '/_files/apiA.xml')), file_get_contents(realpath(__DIR__ . '/_files/apiB.xml'))];
     $this->_fileResolverMock->expects($this->any())->method('get')->will($this->returnValue($configFiles));
     $expectedResult = (require __DIR__ . '/_files/api.php');
     $this->assertEquals($expectedResult, $this->_configReader->read(), 'Error happened during config reading.');
 }
 public function testGetIntegrationsFromConfigReader()
 {
     $integrations = ['foo', 'bar', 'baz'];
     $this->configCacheTypeMock->expects($this->once())->method('load')->with(IntegrationConfig::CACHE_ID)->will($this->returnValue(null));
     $this->configCacheTypeMock->expects($this->once())->method('save')->with(serialize($integrations), IntegrationConfig::CACHE_ID, [TypeIntegration::CACHE_TAG])->will($this->returnValue(null));
     $this->configReaderMock->expects($this->once())->method('read')->will($this->returnValue($integrations));
     $this->assertEquals($integrations, $this->integrationConfigModel->getIntegrations());
 }
 /**
  * Return integrations loaded from cache if enabled or from files merged previously
  *
  * @return array
  */
 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, [TypeIntegration::CACHE_TAG]);
         }
     }
     return $this->_integrations;
 }