You are here

function MemCacheClearCase::clearCidTest in Memcache API and Integration 6

Same name and namespace in other branches
  1. 7 tests/memcache.test \MemCacheClearCase::clearCidTest()
  2. 7 tests/memcache6.test \MemCacheClearCase::clearCidTest()

Test clearing using a cid.

2 calls to MemCacheClearCase::clearCidTest()
MemCacheClearCase::testClearCidLifetime in tests/memcache.test
Test clearing the cache with a cid, with cache lifetime.
MemCacheClearCase::testClearCidNoLifetime in tests/memcache.test
Test clearing the cache with a cid, no cache lifetime.

File

tests/memcache.test, line 296

Class

MemCacheClearCase
Test cache clearing methods.

Code

function clearCidTest() {
  variable_set("cache_flush_{$this->default_bin}", 0);
  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), t('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), t('Two caches still exists after clearing cid "*" with wildcard false.'));
}