Ejemplo n.º 1
0
 public function testCache()
 {
     $cache = new ArrayCache();
     $this->assertFalse($cache->has('foo'));
     $cache->set('foo', 'bar');
     $this->assertEquals('bar', $cache->get('foo'));
     $this->assertTrue($cache->has('foo'));
     $cache->remove('foo');
     $this->assertFalse($cache->has('foo'));
 }
 public function testDump_withoutCache_loadsFromOriginal()
 {
     $cacheKey = md5('0dump');
     $content = 'original';
     $asset = new StringAsset($content);
     $assetCollection = new AssetCollection(array($asset));
     $cache = new ArrayCache();
     $cachedCollection = new AssetCacheCollection($assetCollection, $cache);
     $this->assertSame($content, $cachedCollection->dump());
     $this->assertSame($content, $cache->get($cacheKey));
 }