You are here

function CacheIsEmptyCase::testIsEmpty in SimpleTest 7

Test clearing using a cid.

File

tests/cache.test, line 337

Class

CacheIsEmptyCase
Test cache_is_empty() function.

Code

function testIsEmpty() {

  // Clear the cache bin.
  cache_clear_all('*', $this->default_bin);
  $this
    ->assertTrue(cache_is_empty($this->default_bin), t('The cache bin is empty'));

  // Add some data to the cache bin.
  cache_set($this->default_cid, $this->default_value, $this->default_bin);
  $this
    ->assertCacheExists(t('Cache was set.'), $this->default_value, $this->default_cid);
  $this
    ->assertFalse(cache_is_empty($this->default_bin), t('The cache bin is not empty'));

  // Remove the cached data.
  cache_clear_all($this->default_cid, $this->default_bin);
  $this
    ->assertCacheRemoved(t('Cache was removed.'), $this->default_cid);
  $this
    ->assertTrue(cache_is_empty($this->default_bin), t('The cache bin is empty'));
}