/**
  * @expectedException \Exception
  */
 public function testRemoveAllUnWorkingAdapters()
 {
     $data = new \Itkg\Core\Cache\CacheableData('my_key', null, array('values'));
     $adapters = array(new \Itkg\Core\Cache\Adapter\Redis(array('host' => 'localhost', 'port' => 80)));
     $chain = new \Itkg\Core\Cache\Adapter\Chain($adapters);
     $chain->remove($data);
 }
Beispiel #2
0
 public function testFirstAdapterNoContainsCache()
 {
     $data = new \Itkg\Core\Cache\CacheableData('my_key', null, array('values'));
     $stub = $this->getMock('Itkg\\Core\\Cache\\Adapter\\Redis', array(), array(array()));
     $stub->expects($this->once())->method('get')->with($data)->will($this->returnValue(false));
     $secondStub = $this->getMock('Itkg\\Core\\Cache\\Adapter\\Redis', array(), array(array()));
     $secondStub->expects($this->once())->method('get');
     $adapters = array($stub, $secondStub);
     $chain = new \Itkg\Core\Cache\Adapter\Chain($adapters, new \Itkg\Core\Cache\Adapter\Chain\UseAllStrategy());
     $chain->get($data);
 }
Beispiel #3
0
 public function testDefaultStrategy()
 {
     $adapters = array($this->getMock('Itkg\\Core\\Cache\\Adapter\\Redis', array(), array(array())));
     $chain = new \Itkg\Core\Cache\Adapter\Chain($adapters);
     $this->assertInstanceOf('Itkg\\Core\\Cache\\Adapter\\Chain\\UseFirstWorkingStrategy', $chain->getCachingStrategy());
 }