You are here

function ApcCacheClearCase::testFlushAllCaches in APC - Alternative PHP Cache 7

Test drupal_flush_all_caches().

File

tests/apc.test, line 333

Class

ApcCacheClearCase
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), t('All cache entries removed from @bin.', array(
      '@bin' => $bin,
    )));
  }
}