quickDrupalTest.php

  1. 8.0.x tests/quickDrupalTest.php
  2. 6.x tests/quickDrupalTest.php
  3. 7.x tests/quickDrupalTest.php
  4. 5.x tests/quickDrupalTest.php
  5. master tests/quickDrupalTest.php

Classes

Namesort descending Description
quickDrupalCase core-quick-drupal tests.

File

tests/quickDrupalTest.php
View source
  1. <?php
  2. /**
  3. * core-quick-drupal tests.
  4. *
  5. * @group quick-drupal
  6. * @group slow
  7. */
  8. class quickDrupalCase extends Drush_CommandTestCase {
  9. /**
  10. * Path to test make files.
  11. */
  12. protected $makefile_path;
  13. /**
  14. * Initialize $makefile_path.
  15. */
  16. function __construct() {
  17. $this->makefile_path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'makefiles';
  18. }
  19. /**
  20. * Run a given quick-drupal test.
  21. *
  22. * @param $test
  23. * The test makefile to run, as defined by $this->getQuickDrupalTestParameters();
  24. */
  25. private function runQuickDrupalTest($test) {
  26. $config = $this->getQuickDrupalTestParameters($test);
  27. $default_options = array(
  28. 'yes' => NULL,
  29. 'no-server' => NULL,
  30. );
  31. $options = array_merge($config['options'], $default_options);
  32. if (array_key_exists('makefile', $config)) {
  33. $makefile = $this->makefile_path . DIRECTORY_SEPARATOR . $config['makefile'];
  34. $options['makefile'] = $makefile;
  35. }
  36. $return = !empty($config['fail']) ? self::EXIT_ERROR : self::EXIT_SUCCESS;
  37. $target = UNISH_SANDBOX . '/qd-' . $test;
  38. $options['root'] = $target;
  39. $this->drush('core-quick-drupal', $config['args'], $options, NULL, NULL, $return);
  40. // Use pm-list to determine if all of the correct modules were enabled
  41. if (empty($config['fail'])) {
  42. $this->drush('pm-list', array(), array('root' => $target, 'status' => 'enabled', 'no-core' => NULL, 'pipe' => NULL));
  43. $output = $this->getOutput();
  44. $this->assertEquals($config['expected-modules'], $output, 'quick-drupal included the correct set of modules');
  45. }
  46. }
  47. function testQuickDrupal() {
  48. $this->runQuickDrupalTest('devel');
  49. }
  50. function getQuickDrupalTestParameters($key) {
  51. static $tests = array(
  52. 'devel' => array(
  53. 'name' => 'Test quick-drupal with a makefile that downloads devel',
  54. 'makefile' => 'qd-devel.make',
  55. 'expected-modules' => 'devel',
  56. 'args' => array(),
  57. 'options' => array(),
  58. ),
  59. );
  60. return $tests[$key];
  61. }
  62. }