diff options
Diffstat (limited to 'sites/all/modules/ctools/tests/css_cache.test')
-rw-r--r-- | sites/all/modules/ctools/tests/css_cache.test | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/sites/all/modules/ctools/tests/css_cache.test b/sites/all/modules/ctools/tests/css_cache.test new file mode 100644 index 000000000..e289b42c9 --- /dev/null +++ b/sites/all/modules/ctools/tests/css_cache.test @@ -0,0 +1,48 @@ +<?php +/** + * @file + * Tests the custom CSS cache handler. + */ + +/** + * Tests the custom CSS cache handler. + */ +class CtoolsObjectCache extends DrupalWebTestCase { + + /** + * {@inheritdoc} + */ + public static function getInfo() { + return array( + 'name' => 'Ctools CSS cache', + 'description' => 'Tests the custom CSS cache handler.', + 'group' => 'Chaos Tools Suite', + ); + } + + /** + * {@inheritdoc} + */ + public function setUp() { + parent::setUp('ctools'); + } + + /** + * Tests the custom CSS cache handler. + * + * @see https://drupal.org/node/1313368 + */ + 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.'); + } + +} |