Exemplo n.º 1
0
 /**
  * Test set of processed types data.
  */
 public function testSetTypesData()
 {
     $this->_typeProcessor->setTypeData('typeC', ['dataC']);
     $this->assertEquals(['typeC' => ['dataC']], $this->_typeProcessor->getTypesData());
     $typeData = ['typeA' => ['dataA'], 'typeB' => ['dataB']];
     $this->_typeProcessor->setTypesData($typeData);
     $this->assertEquals($typeData, $this->_typeProcessor->getTypesData());
 }
Exemplo n.º 2
0
 /**
  * Return routes loaded from cache if enabled or from files merged previously
  *
  * @return array
  */
 public function getRoutesConfig()
 {
     if (null === $this->routes) {
         $routesConfig = $this->cache->load(self::ROUTES_CONFIG_CACHE_ID);
         $typesData = $this->cache->load(self::REFLECTED_TYPES_CACHE_ID);
         if ($routesConfig && is_string($routesConfig) && $typesData && is_string($typesData)) {
             $this->routes = unserialize($routesConfig);
             $this->typeProcessor->setTypesData(unserialize($typesData));
         } else {
             $this->routes = $this->initRoutesMetadata();
             $this->cache->save(serialize($this->routes), self::ROUTES_CONFIG_CACHE_ID);
             $this->cache->save(serialize($this->typeProcessor->getTypesData()), self::REFLECTED_TYPES_CACHE_ID);
         }
     }
     return $this->routes;
 }