public function testRead()
 {
     $configFiles = [file_get_contents(realpath(__DIR__ . '/_files/webapiA.xml')), file_get_contents(realpath(__DIR__ . '/_files/webapiB.xml'))];
     $this->_fileResolverMock->expects($this->any())->method('get')->will($this->returnValue($configFiles));
     $expectedResult = (require __DIR__ . '/_files/webapi.php');
     $this->assertEquals($expectedResult, $this->_configReader->read(), 'Error happened during config reading.');
 }
Exemple #2
0
 /**
  * Return services loaded from cache if enabled or from files merged previously
  *
  * @return array
  */
 public function getServices()
 {
     if (null === $this->services) {
         $services = $this->cache->load(self::CACHE_ID);
         if ($services && is_string($services)) {
             $this->services = unserialize($services);
         } else {
             $this->services = $this->configReader->read();
             $this->cache->save(serialize($this->services), self::CACHE_ID);
         }
     }
     return $this->services;
 }
Exemple #3
0
 /**
  * Return services loaded from cache if enabled or from files merged previously
  *
  * @return array
  */
 public function getServices()
 {
     if (null === $this->_services) {
         $services = $this->_loadFromCache();
         if ($services && is_string($services)) {
             $this->_services = unserialize($services);
         } else {
             $this->_services = $this->_configReader->read();
             $this->_saveToCache(serialize($this->_services));
         }
     }
     return $this->_services;
 }