function CacheClearCase::testFlushAllCaches
Test drupal_flush_all_caches().
File
-
modules/
simpletest/ tests/ cache.test, line 325
Class
- CacheClearCase
- Test cache clearing methods.
Code
function testFlushAllCaches() {
// Create cache entries for each flushed cache bin.
$bins = array(
'cache',
'cache_filter',
'cache_page',
'cache_boostrap',
'cache_path',
);
$bins = array_merge(module_invoke_all('flush_caches'), $bins);
foreach ($bins as $id => $bin) {
$id = 'test_cid_clear' . $id;
cache_set($id, $this->default_value, $bin);
}
// Remove all caches then make sure that they are cleared.
drupal_flush_all_caches();
foreach ($bins as $id => $bin) {
$id = 'test_cid_clear' . $id;
$this->assertFalse($this->checkCacheExists($id, $this->default_value, $bin), format_string('All cache entries removed from @bin.', array(
'@bin' => $bin,
)));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.