css_cache.test 1.1 KB

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