ApcCacheClearCase::testFlushAllCaches()
contains the following code.
// 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);
$value = $this->randomString();
foreach ($bins as $id => $bin) {
$id = 'test_cid_clear' . $id;
cache_set($id, $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, $value, $bin), t('All cache entries removed from @bin.', array('@bin' => $bin)));
}
SInce only the cache_apc bin uses the DrupalApcCache
class, all those bins are created in the database. To test the DrupalApcCache
class, the following lines must be added to the setUp()
method.
$bins = array('cache', 'cache_filter', 'cache_page', 'cache_boostrap', 'cache_path');
foreach($bins as $bin) {
variable_set("cache_class_$bin", 'DrupalApcCache');
}
In the code used by ApcCacheClearCase::testFlushAllCaches()
, the line calling module_invoke_all('flush_caches')
needs to be removed: The test just needs to verify the cache bins in the APCu store are removed, which in this case are cache, cache_filter, cache_page, cache_boostrap, and cache_path. The other cache bins are stored in the database and are already tested by Drupal core.