X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=vendor%2Fdrush%2Fdrush%2Ftests%2FquickDrupalTest.php;fp=vendor%2Fdrush%2Fdrush%2Ftests%2FquickDrupalTest.php;h=d44982e8bce456100eb3d7006d057f37d0f4ab64;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/vendor/drush/drush/tests/quickDrupalTest.php b/vendor/drush/drush/tests/quickDrupalTest.php new file mode 100644 index 000000000..d44982e8b --- /dev/null +++ b/vendor/drush/drush/tests/quickDrupalTest.php @@ -0,0 +1,74 @@ +makefile_path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'makefiles'; + } + + /** + * Run a given quick-drupal test. + * + * @param $test + * The test makefile to run, as defined by $this->getQuickDrupalTestParameters(); + */ + private function runQuickDrupalTest($test) { + $config = $this->getQuickDrupalTestParameters($test); + $default_options = array( + 'yes' => NULL, + 'no-server' => NULL, + ); + $options = array_merge($config['options'], $default_options); + if (array_key_exists('makefile', $config)) { + $makefile = $this->makefile_path . DIRECTORY_SEPARATOR . $config['makefile']; + $options['makefile'] = $makefile; + } + $return = !empty($config['fail']) ? self::EXIT_ERROR : self::EXIT_SUCCESS; + $target = UNISH_SANDBOX . '/qd-' . $test; + $options['root'] = $target; + $this->drush('core-quick-drupal', $config['args'], $options, NULL, NULL, $return); + + // Use pm-list to determine if all of the correct modules were enabled + if (empty($config['fail'])) { + $this->drush('pm-list', array(), array('root' => $target, 'status' => 'enabled', 'no-core' => NULL, 'pipe' => NULL)); + $output = $this->getOutput(); + $this->assertEquals($config['expected-modules'], $output, 'quick-drupal included the correct set of modules'); + } + } + + function testQuickDrupal() { + $this->runQuickDrupalTest('devel'); + } + + function getQuickDrupalTestParameters($key) { + $tests = array( + 'devel' => array( + 'name' => 'Test quick-drupal with a makefile that downloads devel', + 'makefile' => 'qd-devel.make', + 'expected-modules' => 'devel', + 'args' => array(), + 'options' => array( + 'skip' => NULL, // for speed up enable of devel module. + 'browser' => 0, + 'profile' => UNISH_DRUPAL_MAJOR_VERSION == 6 ? 'standard' : 'testing', + ), + ), + ); + return $tests[$key]; + } +}