function CacheClearCase::testClearArray

Test clearing using an array.

File

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

Class

CacheClearCase
Test cache clearing methods.

Code

function testClearArray() {
  // Create three cache entries.
  cache_set('test_cid_clear1', $this->default_value, $this->default_bin);
  cache_set('test_cid_clear2', $this->default_value, $this->default_bin);
  cache_set('test_cid_clear3', $this->default_value, $this->default_bin);
  $this->assertTrue($this->checkCacheExists('test_cid_clear1', $this->default_value) && $this->checkCacheExists('test_cid_clear2', $this->default_value) && $this->checkCacheExists('test_cid_clear3', $this->default_value), 'Three cache entries were created.');
  // Clear two entries using an array.
  cache_clear_all(array(
    'test_cid_clear1',
    'test_cid_clear2',
  ), $this->default_bin);
  $this->assertFalse($this->checkCacheExists('test_cid_clear1', $this->default_value) || $this->checkCacheExists('test_cid_clear2', $this->default_value), 'Two cache entries removed after clearing with an array.');
  $this->assertTrue($this->checkCacheExists('test_cid_clear3', $this->default_value), 'Entry was not cleared from the cache');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.