1.20.x cache.test | CacheClearCase::testFlushAllCaches() |
Test backdrop_flush_all_caches().
File
- modules/
simpletest/ tests/ cache.test, line 282
Class
- CacheClearCase
- Test cache clearing methods.
Code
function testFlushAllCaches() {
// Create cache entries for each flushed cache bin.
$bins = array('cache', 'filter', 'page', 'bootstrap', 'path');
$bins = array_merge(module_invoke_all('flush_caches'), $bins);
foreach ($bins as $id => $bin) {
$cid = 'test_cid_clear' . $id;
cache($bin)->set($cid, $this->default_value);
}
// Remove all caches then make sure that they are cleared.
backdrop_flush_all_caches();
foreach ($bins as $id => $bin) {
$cid = 'test_cid_clear' . $id;
$this->assertFalse($this->checkCacheExists($cid, $this->default_value, $bin), format_string('All cache entries removed from @bin.', array('@bin' => $bin)));
}
}