コード例 #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_withCache_loadsFromCache()
 {
     $cacheKey = md5('dump');
     $content = 'cache';
     $mockedAssetCollection = $this->getMockedAssetCollection();
     $mockedAssetCollection->expects($this->once())->method('getFilters')->willReturn(array());
     $mockedAssetCollection->expects($this->never())->method('dump');
     $cache = new ArrayCache();
     $cache->set($cacheKey, $content);
     $cachedCollection = new AssetCacheCollection($mockedAssetCollection, $cache);
     $this->assertSame($content, $cachedCollection->dump());
 }