public function testMemcache() { $this->markTestIncomplete("Memcache extensions not found"); // @todo fix problem with memcache if (false === extension_loaded('memcache')) { $this->markTestIncomplete("Memcache extensions not found"); } $config = new Config($this->datadir . '/test-memcache.ini'); $cache = Cache::load($config); $cache->set('app:test', array('test')); $this->assertEquals(array('test'), $cache->get('app:test')); $obj = new \StdClass(); $cache->set('app:test2', $obj); $this->assertEquals($obj, $cache->get('app:test2')); $this->assertFalse($cache->has('app:noexists')); }
public function testSetExceptionBadVariable() { $filename = $this->datadir . '/test-config.ini'; $config = new Config($filename); Di::getDefault()->setShared('cache', Cache::load($config)); $config->loadFromDb(); $this->setExpectedException('\\Centreon\\Internal\\Exception', "This configuration default - novariable does not exists into database."); $config->set('default', 'novariable', 'test'); }
/** * Init cache */ private function initCache() { $cache = Cache::load($this->config); $this->di->setShared('cache', $cache); }