css_cache.test
1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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.');
}
}