public function testStack() { $source = new FakeSource(); $stack = LayerCache::forSource([$source, 'get'])->toStack('X'); $this->assertSame($stack, LayerCache::stack('X')); }
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); }