You are here

public function Redis_Tests_Cache_FlushUnitTestCase::testNormalFlushing in Redis 7.3

File

lib/Redis/Tests/Cache/FlushUnitTestCase.php, line 99

Class

Redis_Tests_Cache_FlushUnitTestCase

Code

public function testNormalFlushing() {
  $backend = $this
    ->getBackend();
  $backendUntouched = $this
    ->getBackend();

  // Set a few entries.
  $backend
    ->set('test13', 'foo');
  $backend
    ->set('test14', 'bar', CACHE_TEMPORARY);
  $backend
    ->set('test15', 'baz', time() + 3);
  $backendUntouched
    ->set('test16', 'dog');
  $backendUntouched
    ->set('test17', 'cat', CACHE_TEMPORARY);
  $backendUntouched
    ->set('test18', 'xor', time() + 5);

  // This should not do anything (bugguy command)
  $backend
    ->clear('', true);
  $backend
    ->clear('', false);
  $this
    ->assertNotIdentical(false, $backend
    ->get('test13'));
  $this
    ->assertNotIdentical(false, $backend
    ->get('test14'));
  $this
    ->assertNotIdentical(false, $backend
    ->get('test15'));
  $this
    ->assertNotIdentical(false, $backendUntouched
    ->get('test16'));
  $this
    ->assertNotIdentical(false, $backendUntouched
    ->get('test17'));
  $this
    ->assertNotIdentical(false, $backendUntouched
    ->get('test18'));

  // This should clear every one, permanent and volatile
  $backend
    ->clear('*', true);
  $this
    ->assertFalse($backend
    ->get('test13'));
  $this
    ->assertFalse($backend
    ->get('test14'));
  $this
    ->assertFalse($backend
    ->get('test15'));
  $this
    ->assertNotIdentical(false, $backendUntouched
    ->get('test16'));
  $this
    ->assertNotIdentical(false, $backendUntouched
    ->get('test17'));
  $this
    ->assertNotIdentical(false, $backendUntouched
    ->get('test18'));
}