You are here

public function Redis_Tests_Cache_FixesUnitTestCase::testGetMultipleAlterCidsWhenCacheHitsOnly in Redis 7.3

File

lib/Redis/Tests/Cache/FixesUnitTestCase.php, line 188

Class

Redis_Tests_Cache_FixesUnitTestCase
Bugfixes made over time test class.

Code

public function testGetMultipleAlterCidsWhenCacheHitsOnly() {
  $backend = $this
    ->getBackend();
  $backend
    ->clear('*', true);

  // It seems that there are leftovers.
  $backend
    ->set('mtest1', 'pouf');
  $cids_partial_hit = array(
    'foo' => 'mtest1',
    'bar' => 'mtest2',
  );
  $entries = $backend
    ->getMultiple($cids_partial_hit);
  $this
    ->assertIdentical(1, count($entries));

  // Note that the key is important because the method should
  // keep the keys synchronized.
  $this
    ->assertEqual(array(
    'bar' => 'mtest2',
  ), $cids_partial_hit);
  $backend
    ->clear('mtest1');
  $cids_no_hit = array(
    'cat' => 'mtest1',
    'dog' => 'mtest2',
  );
  $entries = $backend
    ->getMultiple($cids_no_hit);
  $this
    ->assertIdentical(0, count($entries));
  $this
    ->assertEqual(array(
    'cat' => 'mtest1',
    'dog' => 'mtest2',
  ), $cids_no_hit);
}