fe_nodequeue.test 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. /**
  3. * @file
  4. * Tests for the Features Extra Nodequeue module.
  5. */
  6. /**
  7. * Tests the functionality of FE Nodequeue.
  8. */
  9. class FeaturesExtraNodequeueTestCase extends FeaturesExtraTestCase {
  10. // The installation profile that will be used to run the tests.
  11. protected $profile = 'testing';
  12. // Stores a test nodequeue.
  13. protected $nodequeue;
  14. public static function getInfo() {
  15. return array(
  16. 'name' => 'FE Nodequeue',
  17. 'description' => 'Tests Features integration with the Nodequeue module.',
  18. 'group' => 'Features Extra',
  19. );
  20. }
  21. /**
  22. * Check that all modules that are required for the test suite are available.
  23. */
  24. public function testRequiredModules() {
  25. $required_modules = array(
  26. 'nodequeue',
  27. 'ctools',
  28. 'features',
  29. 'fe_nodequeue',
  30. 'features_extra_test',
  31. );
  32. foreach ($required_modules as $module) {
  33. $this->assertTrue(module_exists($module), format_string('The required module @module exists.', array('@module' => $module)));
  34. }
  35. }
  36. /**
  37. * Test if nodequeues can be reverted and that overrides are detected.
  38. */
  39. public function testNodequeueRevert() {
  40. // Ensure that the exported nodequeue is properly available.
  41. $this->nodequeue = _fe_nodequeue_load_queue_by_name('features_extra_test_nodequeue');
  42. $this->assertTrue(!empty($this->nodequeue), 'The reverted nodequeue is present.');
  43. $this->revertComponents(array('fe_nodequeue'));
  44. }
  45. /**
  46. * Change the title of the test nodequeue so the component becomes overridden.
  47. */
  48. protected function override_fe_nodequeue() {
  49. $this->nodequeue->title = $this->randomString();
  50. nodequeue_save($this->nodequeue);
  51. // Reset static caches.
  52. // Note: we are using a variant of nodequeue_get_qid_map() that uses
  53. // drupal_static() instead of a static variable to cache the results.
  54. // @see http://drupal.org/node/1666556
  55. drupal_static_reset('_fe_nodequeue_get_qid_map');
  56. }
  57. }