示例#1
0
 /**
  * @expectedException \RuntimeException
  */
 public function testRegisterCacheSameNameThrowsUp()
 {
     LayerCache::registerCache('mc', new FakeCache());
     LayerCache::registerCache('mc', new FakeCache());
 }
示例#2
0
 public function testAddLayerWithNamedCache()
 {
     $cache = $this->getMock('FakeCache', ['get']);
     $cache->expects($this->once())->method('get')->with('kee')->will($this->returnValue(serialize(['d' => 'DATA', 'e' => time() + 10])));
     LayerCache::registerCache('cache1', $cache);
     LayerCache::forSource([new FakeSource(), 'get'])->addLayer('cache1')->toStack('named');
     $stack = LayerCache::stack('named');
     $v = $stack->get('kee');
     $this->assertSame('DATA', $v);
 }