You are here

function CacheClearCase::testClearCid in Drupal 7

Test clearing using a cid.

File

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

Class

CacheClearCase
Test cache clearing methods.

Code

function testClearCid() {
  cache_set('test_cid_clear', $this->default_value, $this->default_bin);
  $this
    ->assertCacheExists(t('Cache was set for clearing cid.'), $this->default_value, 'test_cid_clear');
  cache_clear_all('test_cid_clear', $this->default_bin);
  $this
    ->assertCacheRemoved(t('Cache was removed after clearing cid.'), 'test_cid_clear');
  cache_set('test_cid_clear1', $this->default_value, $this->default_bin);
  cache_set('test_cid_clear2', $this->default_value, $this->default_bin);
  $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 false.');
  cache_clear_all('*', $this->default_bin);
  $this
    ->assertTrue($this
    ->checkCacheExists('test_cid_clear1', $this->default_value) && $this
    ->checkCacheExists('test_cid_clear2', $this->default_value), 'Two caches still exists after clearing cid "*" with wildcard false.');
}