You are here

public function CtoolsCSSObjectCache::testCssCache in Chaos Tool Suite (ctools) 7

Tests the custom CSS cache handler.

See also

https://drupal.org/node/1313368

File

tests/css_cache.test, line 33

Class

CtoolsCSSObjectCache
Tests the custom CSS cache handler.

Code

public function testCssCache() {

  // Create a CSS cache entry.
  $filename = ctools_css_cache('body { color: red; }');

  // Perform a cron run. The CSS cache entry should not be removed.
  $this
    ->cronRun();
  $this
    ->assertTrue(file_exists($filename), 'The CSS cache is not cleared after performing a cron run.');

  // Manually clear the caches. The CSS cache entry should be removed.
  drupal_flush_all_caches();
  $this
    ->assertFalse(file_exists($filename), 'The CSS cache is cleared after clearing all caches.');
}