/** * @param CacheProvider $cacheAdapter * @param array $cacheSettings */ private function addConnection(CacheProvider $cacheAdapter, array $cacheSettings) { $proxy = new \Dafiti\Silex\Cache\Proxy(); $connection = $proxy->getAdapter($cacheSettings); $setMethod = sprintf('set%s', $cacheSettings['adapter']); $cacheAdapter->{$setMethod}($connection); }
/** * @covers Dafiti\Silex\Cache\Proxy::getAdapter * @expectedException \Dafiti\Silex\Exception\InvalidCacheConfig */ public function testGetAdapterShouldThrowsInvalidCacheConfigWhenClassIsNotExists() { $proxy = new \Dafiti\Silex\Cache\Proxy(); $params = ['adapter' => 'Crazy', 'host' => '127.0.0.1', 'port' => 11211, 'connectable' => false]; $proxy->getAdapter($params); }