You are here

public function Redis_Tests_Cache_FlushUnitTestCase::testPrefixDeletionWithSeparatorChar in Redis 7.3

File

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

Class

Redis_Tests_Cache_FlushUnitTestCase

Code

public function testPrefixDeletionWithSeparatorChar() {
  $backend = $this
    ->getBackend();
  $backend
    ->set('testprefix10', 'foo');
  $backend
    ->set('testprefix11', 'foo');
  $backend
    ->set('testprefix:12', 'bar');
  $backend
    ->set('testprefix:13', 'baz');
  $backend
    ->set('testnoprefix14', 'giraffe');
  $backend
    ->set('testnoprefix:15', 'elephant');
  $backend
    ->clear('testprefix:', true);
  $this
    ->assertFalse($backend
    ->get('testprefix:12'));
  $this
    ->assertFalse($backend
    ->get('testprefix:13'));

  // @todo Temporary fix
  // At the moment shard enabled backends will erase all data instead
  // of just removing by prefix, so those tests won't pass
  if (!$backend
    ->isSharded()) {
    $this
      ->assertNotIdentical(false, $backend
      ->get('testprefix10'));
    $this
      ->assertNotIdentical(false, $backend
      ->get('testprefix11'));
    $this
      ->assertNotIdentical(false, $backend
      ->get('testnoprefix14'));
    $this
      ->assertNotIdentical(false, $backend
      ->get('testnoprefix:15'));
  }
  $backend
    ->clear('testprefix', true);
  $this
    ->assertFalse($backend
    ->get('testprefix10'));
  $this
    ->assertFalse($backend
    ->get('testprefix11'));

  // @todo Temporary fix
  // At the moment shard enabled backends will erase all data instead
  // of just removing by prefix, so those tests won't pass
  if (!$backend
    ->isSharded()) {
    $this
      ->assertNotIdentical(false, $backend
      ->get('testnoprefix14'));
    $this
      ->assertNotIdentical(false, $backend
      ->get('testnoprefix:15'));
  }
}