You are here

class ChainCacheTest in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ChainCacheTest.php \Doctrine\Tests\Common\Cache\ChainCacheTest

Hierarchy

  • class \Doctrine\Tests\Common\Cache\CacheTest extends \Doctrine\Tests\DoctrineTestCase

Expanded class hierarchy of ChainCacheTest

File

vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ChainCacheTest.php, line 9

Namespace

Doctrine\Tests\Common\Cache
View source
class ChainCacheTest extends CacheTest {
  protected function _getCacheDriver() {
    return new ChainCache(array(
      new ArrayCache(),
    ));
  }
  public function testGetStats() {
    $cache = $this
      ->_getCacheDriver();
    $stats = $cache
      ->getStats();
    $this
      ->assertInternalType('array', $stats);
  }
  public function testOnlyFetchFirstOne() {
    $cache1 = new ArrayCache();
    $cache2 = $this
      ->getMockForAbstractClass('Doctrine\\Common\\Cache\\CacheProvider');
    $cache2
      ->expects($this
      ->never())
      ->method('doFetch');
    $chainCache = new ChainCache(array(
      $cache1,
      $cache2,
    ));
    $chainCache
      ->save('id', 'bar');
    $this
      ->assertEquals('bar', $chainCache
      ->fetch('id'));
  }
  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'));
  }
  public function testNamespaceIsPropagatedToAllProviders() {
    $cache1 = new ArrayCache();
    $cache2 = new ArrayCache();
    $chainCache = new ChainCache(array(
      $cache1,
      $cache2,
    ));
    $chainCache
      ->setNamespace('bar');
    $this
      ->assertEquals('bar', $cache1
      ->getNamespace());
    $this
      ->assertEquals('bar', $cache2
      ->getNamespace());
  }
  public function testDeleteToAllProviders() {
    $cache1 = $this
      ->getMockForAbstractClass('Doctrine\\Common\\Cache\\CacheProvider');
    $cache2 = $this
      ->getMockForAbstractClass('Doctrine\\Common\\Cache\\CacheProvider');
    $cache1
      ->expects($this
      ->once())
      ->method('doDelete');
    $cache2
      ->expects($this
      ->once())
      ->method('doDelete');
    $chainCache = new ChainCache(array(
      $cache1,
      $cache2,
    ));
    $chainCache
      ->delete('bar');
  }
  public function testFlushToAllProviders() {
    $cache1 = $this
      ->getMockForAbstractClass('Doctrine\\Common\\Cache\\CacheProvider');
    $cache2 = $this
      ->getMockForAbstractClass('Doctrine\\Common\\Cache\\CacheProvider');
    $cache1
      ->expects($this
      ->once())
      ->method('doFlush');
    $cache2
      ->expects($this
      ->once())
      ->method('doFlush');
    $chainCache = new ChainCache(array(
      $cache1,
      $cache2,
    ));
    $chainCache
      ->flushAll();
  }
  protected function isSharedStorage() {
    return false;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CacheTest::falseCastedValuesProvider public function The following values get converted to FALSE if you cast them to a boolean.
CacheTest::provideCrudValues public function
CacheTest::testBasicCrudOperations public function @dataProvider provideCrudValues
CacheTest::testCachedObject public function Check to see that objects are correctly serialized and unserialized by the cache provider. 1
CacheTest::testDeleteAll public function
CacheTest::testDeleteAllAndNamespaceVersioningBetweenCaches public function
CacheTest::testDeleteAllNamespace public function
CacheTest::testFalseCastedValues public function Check to see that, even if the user saves a value that can be interpreted as false, the cache adapter will still recognize its existence there. 2
CacheTest::testFetchMissShouldReturnFalse public function
CacheTest::testFetchMulti public function
CacheTest::testFetchMultipleObjects public function Check to see that objects fetched via fetchMultiple are properly unserialized 1
CacheTest::testFetchMultiWillFilterNonRequestedKeys public function
CacheTest::testFlushAll public function
CacheTest::testFlushAllAndNamespaceVersioningBetweenCaches public function
CacheTest::testNamespace public function
ChainCacheTest::isSharedStorage protected function Return whether multiple cache providers share the same storage. Overrides CacheTest::isSharedStorage
ChainCacheTest::testDeleteToAllProviders public function
ChainCacheTest::testFetchPropagateToFastestCache public function
ChainCacheTest::testFlushToAllProviders public function
ChainCacheTest::testGetStats public function @group DCOM-43 Overrides CacheTest::testGetStats
ChainCacheTest::testNamespaceIsPropagatedToAllProviders public function
ChainCacheTest::testOnlyFetchFirstOne public function
ChainCacheTest::_getCacheDriver protected function Overrides CacheTest::_getCacheDriver