Skip to content
Snippets Groups Projects
Commit d7fb7b41 authored by Alberto Paderno's avatar Alberto Paderno
Browse files

Issue #3463974: ApcCacheClearCase::testFlushAllCaches() tests bins created...

Issue #3463974: ApcCacheClearCase::testFlushAllCaches() tests bins created outside of the APCu store
parent 51244ddb
No related branches found
No related tags found
1 merge request!33Issue #3463974: ApcCacheClearCase::testFlushAllCaches() tests bins created outside of the APCu store
Pipeline #234799 passed
......@@ -256,6 +256,20 @@ class ApcCacheClearCase extends ApcCacheTestCase {
);
}
/**
* {@inheritdoc}
*/
protected function setUp() {
$bins = array('cache', 'cache_filter', 'cache_page', 'cache_boostrap', 'cache_path');
foreach ($bins as $bin) {
variable_set("cache_flush_$bin", 0);
variable_set("cache_class_$bin", 'DrupalApcCache');
}
parent::setUp();
}
/**
* Tests clearing the cache using a cache ID.
*/
......@@ -263,24 +277,20 @@ class ApcCacheClearCase extends ApcCacheTestCase {
$bin = 'cache_apc';
$value = $this->randomString();
cache_set('test_cid_clear', $value, $bin);
$this->assertCacheExists(t('The cache item was created.'), $value, 'test_cid_clear', $bin);
cache_clear_all('test_cid_clear', $bin);
$this->assertCacheRemoved(t('The cache item was removed.'), 'test_cid_clear', $bin);
$value1 = $this->randomString();
$value2 = $this->randomString();
cache_set('test_cid_clear1', $value1, $bin);
cache_set('test_cid_clear2', $value2, $bin);
$this->assertTrue($this->checkCacheExists('test_cid_clear1', $value1, $bin)
&& $this->checkCacheExists('test_cid_clear2', $value2, $bin),
t('Two cache items were created.'));
cache_clear_all('*', $bin);
$this->assertTrue($this->checkCacheExists('test_cid_clear1', $value1, $bin)
&& $this->checkCacheExists('test_cid_clear2', $value2, $bin),
t('Two caches still exists after clearing values for the * cache ID, where the cache ID is not a wildcard value.'));
......@@ -363,17 +373,16 @@ class ApcCacheClearCase extends ApcCacheTestCase {
* Tests drupal_flush_all_caches().
*/
public 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);
$value = $this->randomString();
// Create cache items for each Drupal core cache bin that
// drupal_flush_all_caches() will clear.
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) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment