Projet

Général

Profil

Paste
Télécharger (1,13 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / ctools / tests / css_cache.test @ 6e3ce7c2

1
<?php
2

    
3
/**
4
 * Tests the custom CSS cache handler.
5
 */
6
class CtoolsCSSObjectCache extends DrupalWebTestCase {
7

    
8
  /**
9
   * {@inheritdoc}
10
   */
11
  public static function getInfo() {
12
    return array(
13
      'name' => 'CSS cache',
14
      'description' => 'Tests the custom CSS cache handler.',
15
      'group' => 'ctools',
16
      'dependencies' => array('ctools'),
17
    );
18
  }
19

    
20
  /**
21
   * {@inheritdoc}
22
   */
23
  public function setUp(array $modules = array()) {
24
    $modules[] = 'ctools';
25
    parent::setUp($modules);
26
  }
27

    
28
  /**
29
   * Tests the custom CSS cache handler.
30
   *
31
   * @see https://drupal.org/node/1313368
32
   */
33
  public function testCssCache() {
34
    // Create a CSS cache entry.
35
    $filename = ctools_css_cache('body { color: red; }');
36

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

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

    
46
}