You are here

function CacheActionsBinTestCase::testClearCacheBin in Cache Actions 7

Same name and namespace in other branches
  1. 6.2 cache_actions.test \CacheActionsBinTestCase::testClearCacheBin()
  2. 7.2 cache_actions.test \CacheActionsBinTestCase::testClearCacheBin()

Test clearing a cache bin.

File

./cache_actions.test, line 77
This file contains the tests for Cache Actions. All tests depend on the panels, views and rules that are defined by the cache actions test module.

Class

CacheActionsBinTestCase
Tests for clearing cache bins.

Code

function testClearCacheBin() {

  // Needed in order to register the default rules.
  drupal_flush_all_caches();

  // Put a dummy value into the cache
  cache_set('dummy', 'dummy_value', 'cache_cache_actions_test');

  // Create a node. This will trigger the rule.
  $node = $this
    ->drupalCreateNode();

  // Let's look at the content of our cache.
  $count = db_result(db_query("SELECT COUNT(*) FROM {cache_cache_actions_test}"));

  // The cache chould be empty now, since we cleared the cache bin.
  $this
    ->assertEqual($count, 0, 'We had ' . $count . ' items in our cache.');
}