You are here

public function ChainCacheTest::testFetchPropagateToFastestCache in Plug 7

File

lib/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ChainCacheTest.php, line 37

Class

ChainCacheTest

Namespace

Doctrine\Tests\Common\Cache

Code

public function testFetchPropagateToFastestCache() {
  $cache1 = new ArrayCache();
  $cache2 = new ArrayCache();
  $cache2
    ->save('bar', 'value');
  $chainCache = new ChainCache(array(
    $cache1,
    $cache2,
  ));
  $this
    ->assertFalse($cache1
    ->contains('bar'));
  $result = $chainCache
    ->fetch('bar');
  $this
    ->assertEquals('value', $result);
  $this
    ->assertTrue($cache2
    ->contains('bar'));
}