public function testSetFailStrategy()
 {
     $cs = new CacheSetting();
     $failStrategyMock = $this->getMock('\\hergot\\databroker\\Plugin\\Cache\\FailStrategyInterface');
     $cs->setFailStrategy($failStrategyMock);
     $this->assertEquals($failStrategyMock, $cs->getFailStrategy());
 }
Beispiel #2
0
 /**
  * @param \hergot\databroker\DataAdapter\DataAdapterInterface $dataAdapter
  * @return \hergot\databroker\Plugin\Cache\CacheSetting
  */
 private function getSettingsForAdapter(DataAdapterInterface $dataAdapter)
 {
     $result = new Cache\CacheSetting();
     $className = get_class($dataAdapter);
     foreach ($this->adapterCacheSettings as $mask => $cacheSetting) {
         $transformedMask = '@^' . str_replace('\\*', '.*', preg_quote($mask, '@')) . '$@';
         if (preg_match($transformedMask, $className)) {
             $result->merge($cacheSetting);
         }
     }
     return $result;
 }