示例#1
0
 /**
  * @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);
 }
示例#2
0
 /**
  * @test
  * @expectedException Ding\Cache\Exception\CacheException
  */
 public function cannot_get_invalid_cache()
 {
     CacheLocator::configure(array('bdef' => array('impl' => 'asdads')));
     CacheLocator::getDefinitionsCacheInstance();
 }
示例#3
0
 /**
  * @test
  */
 public function can_remove()
 {
     $container = ContainerImpl::getInstance($this->_properties);
     $cache = CacheLocator::getProxyCacheInstance();
     $cache->remove('a');
 }
示例#4
0
 /**
  * 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;
 }