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 e4c061ad Assos Assos
<?php
2
3
/**
4
 * Tests the custom CSS cache handler.
5
 */
6 7e72b748 Assos Assos
class CtoolsCSSObjectCache extends DrupalWebTestCase {
7 e4c061ad Assos Assos
8
  /**
9
   * {@inheritdoc}
10
   */
11
  public static function getInfo() {
12
    return array(
13 7e72b748 Assos Assos
      'name' => 'CSS cache',
14 e4c061ad Assos Assos
      'description' => 'Tests the custom CSS cache handler.',
15 1e39edcb Assos Assos
      'group' => 'ctools',
16 7e72b748 Assos Assos
      'dependencies' => array('ctools'),
17 e4c061ad Assos Assos
    );
18
  }
19
20
  /**
21 c304a780 Assos Assos
   * {@inheritdoc}
22 e4c061ad Assos Assos
   */
23 c304a780 Assos Assos
  public function setUp(array $modules = array()) {
24 7e72b748 Assos Assos
    $modules[] = 'ctools';
25
    parent::setUp($modules);
26 e4c061ad Assos Assos
  }
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
}