/** * @expectedException \RuntimeException */ public function testRegisterCacheSameNameThrowsUp() { LayerCache::registerCache('mc', new FakeCache()); LayerCache::registerCache('mc', new FakeCache()); }
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); }