示例#1
0
 public function testMakeMakesAdapterWithOptions()
 {
     $config = ['defaults' => ['adapter' => 'fake', 'options' => ['cot' => 'cop']], 'adapters' => ['fake' => ['class' => 'Es\\Cache\\Test\\FakeAdapter', 'options' => ['bak' => 'bar', 'baz' => 'bat']]]];
     CacheFactory::setConfig($config);
     $cache = CacheFactory::make('some_namespace', 'fake');
     $expected = ['cot' => 'cop', 'bak' => 'bar', 'baz' => 'bat', 'namespace' => 'some_namespace'];
     $this->assertEquals($cache->getOptions(), $expected);
 }
 /**
  * Configures the cache factory.
  *
  * @param \Es\System\SystemEvent $event The system event
  */
 public function configureFactory(SystemEvent $event)
 {
     $systemConfig = $this->getConfig();
     $initialConfig = $systemConfig->getInitialConfig();
     if (isset($initialConfig['cache'])) {
         $cacheConfig = (array) $initialConfig['cache'];
         CacheFactory::setConfig($cacheConfig);
     }
 }