function createCacheConnectionByName($name) { $conf = $this->toolkit->getConf('cache'); if (!$conf->get('cache_enabled')) { return $this->createCacheFakeConnection(); } else { try { $dsn = lmbToolkit::instance()->getConf('cache')->get($name . '_cache_dsn'); if (!is_object($dsn)) { $dsn = new lmbUri($dsn); } if (!($wrapper = $dsn->getQueryItem('wrapper'))) { $wrapper = array(); } if ($conf->get('taggable_cache_enabled', false)) { $wrapper[] = 'taggable'; } if ($conf->get('mint_cache_enabled', false)) { $wrapper[] = 'mint'; } if ($conf->get('cache_log_enabled', false)) { $wrapper[] = 'logged'; } $dsn->addQueryItem('wrapper', $wrapper); return $this->createCacheConnectionByDSN($dsn); } catch (Exception $e) { return $this->createCacheFakeConnection(); } } }
function testCreateCacheConnectionByDSN_WithWrapper() { $dsn = new lmbUri('memory:'); $dsn->addQueryItem('wrapper', array('mint', 'logged')); $connection = lmbToolkit::instance()->createCacheConnectionByDSN($dsn); $this->assertEqual($connection->getType(), 'memory'); $this->assertIsA($connection, 'lmbLoggedCacheWrapper'); $this->assertIsA($connection->getWrappedConnection(), 'lmbMintCacheWrapper'); $this->assertIsA($connection->getWrappedConnection()->getWrappedConnection(), 'lmbCacheMemoryConnection'); }
function testChaining() { $uri = new lmbUri(); $uri->addQueryItem('chaining', 'supported')->setHost('everywhere.com')->setPath('/')->setProtocol('http'); $this->assertEqual('http://everywhere.com/?chaining=supported', $uri->toString()); }
function testAddQueryItemUrlencode2() { $str = 'http://*****:*****@localhost:81/test.php?foo=bar#23'; $uri = new lmbUri($str); $uri->addQueryItem('foo', array('i1' => ' bar ')); $this->assertEqual($uri->getQueryString(), 'foo[i1]=+bar+'); }