/** * @test */ public function can_remove() { $container = ContainerImpl::getInstance($this->_properties); $cache = CacheLocator::getProxyCacheInstance(); $result = false; $cache->fetch('a', $result); $this->assertFalse($result); $cache->store('a', 'something'); $result = false; $cache->fetch('a', $result); $this->assertTrue($result); $cache->remove('a'); $result = false; $cache->fetch('a', $result); $this->assertFalse($result); }
/** * @test * @expectedException Ding\Cache\Exception\CacheException */ public function cannot_get_invalid_cache() { CacheLocator::configure(array('bdef' => array('impl' => 'asdads'))); CacheLocator::getDefinitionsCacheInstance(); }
/** * @test */ public function can_remove() { $container = ContainerImpl::getInstance($this->_properties); $cache = CacheLocator::getProxyCacheInstance(); $cache->remove('a'); }
/** * This will return a container * * @param array $properties Container properties. * * @return ContainerImpl */ public static function getInstance(array $properties = array()) { if (self::$_containerInstance === false) { // Init cache subsystems. if (isset($properties['ding']['cache'])) { CacheLocator::configure($properties['ding']['cache']); } if (isset($properties['ding']['log4php.properties'])) { \Logger::configure($properties['ding']['log4php.properties']); } self::$_containerInstance = new ContainerImpl($properties['ding']['factory']); } return self::$_containerInstance; }