Commit | Line | Data |
---|---|---|
7f254ad8 AE |
1 | <?php |
2 | /** | |
3 | * @file | |
4 | * Tests the custom CSS cache handler. | |
5 | */ | |
6 | ||
7 | /** | |
8 | * Tests the custom CSS cache handler. | |
9 | */ | |
10 | class CtoolsObjectCache extends DrupalWebTestCase { | |
11 | ||
12 | /** | |
13 | * {@inheritdoc} | |
14 | */ | |
15 | public static function getInfo() { | |
16 | return array( | |
17 | 'name' => 'Ctools CSS cache', | |
18 | 'description' => 'Tests the custom CSS cache handler.', | |
19 | 'group' => 'Chaos Tools Suite', | |
20 | ); | |
21 | } | |
22 | ||
23 | /** | |
24 | * {@inheritdoc} | |
25 | */ | |
26 | public function setUp() { | |
27 | parent::setUp('ctools'); | |
28 | } | |
29 | ||
30 | /** | |
31 | * Tests the custom CSS cache handler. | |
32 | * | |
33 | * @see https://drupal.org/node/1313368 | |
34 | */ | |
35 | public function testCssCache() { | |
36 | // Create a CSS cache entry. | |
37 | $filename = ctools_css_cache('body { color: red; }'); | |
38 | ||
39 | // Perform a cron run. The CSS cache entry should not be removed. | |
40 | $this->cronRun(); | |
41 | $this->assertTrue(file_exists($filename), 'The CSS cache is not cleared after performing a cron run.'); | |
42 | ||
43 | // Manually clear the caches. The CSS cache entry should be removed. | |
44 | drupal_flush_all_caches(); | |
45 | $this->assertFalse(file_exists($filename), 'The CSS cache is cleared after clearing all caches.'); | |
46 | } | |
47 | ||
48 | } |