1.20.x cache.test CacheClearCase::testClearWildcard()

Test clearing using wildcard.

File

modules/simpletest/tests/cache.test, line 220

Class

CacheClearCase
Test cache clearing methods.

Code

function testClearWildcard() {
  $cache = cache($this->default_bin);
  $cache->set('test_cid_clear1', $this->default_value);
  $cache->set('test_cid_clear2', $this->default_value);
  $this->assertTrue($this->checkCacheExists('test_cid_clear1', $this->default_value)
    && $this->checkCacheExists('test_cid_clear2', $this->default_value), 
  'Two caches were created for checking cid "*" with wildcard true.');
  $cache->flush();
  $this->assertFalse($this->checkCacheExists('test_cid_clear1', $this->default_value)
    || $this->checkCacheExists('test_cid_clear2', $this->default_value), 
  'Two caches removed after clearing cid "*" with wildcard true.');

  $cache->set('test_cid_clear1', $this->default_value);
  $cache->set('test_cid_clear2', $this->default_value);
  $this->assertTrue($this->checkCacheExists('test_cid_clear1', $this->default_value)
    && $this->checkCacheExists('test_cid_clear2', $this->default_value), 
  'Two caches were created for checking cid substring with wildcard true.');
  $cache->deletePrefix('test_');
  $this->assertFalse($this->checkCacheExists('test_cid_clear1', $this->default_value)
    || $this->checkCacheExists('test_cid_clear2', $this->default_value), 
  'Two caches removed after clearing cid substring with wildcard true.');
}