Commit 91da8bfb authored by moshe weitzman's avatar moshe weitzman

Add PHPUnit based testing of our drush integration.

parent cc56670a
......@@ -42,6 +42,13 @@ COMPATIBILITY NOTES
footer info. Consider setting $GLOBALS['devel_shutdown'] = FALSE if you run into
any issues.
DRUSH UNIT TEST
==================
See develDrushTest.php for an example of unit testing of the Drush integration.
This uses Drush's own test framework, based on PHPUnit. To run the tests, use
phpunit --bootstrap=/path/to/drush/tests/drush_testcase.inc. Note that we must name a file
under /tests there.
AUTHOR/MAINTAINER
======================
-moshe weitzman <weitzman at tejasa DOT com>
......
<?php
/*
* @file
* PHPUnit Tests for devel. This uses Drush's own test framework, based on PHPUnit.
* To run the tests, use phpunit --bootstrap=/path/to/drush/tests/drush_testcase.inc.
* Note that we are pointing to the drush_testcase.inc file under /tests subdir in drush.
*/
class develCase extends Drush_CommandTestCase {
public function testFnView() {
$sites = $this->setUpDrupal(1, TRUE);
$options = array(
'root' => $this->webroot(),
'uri' => key($sites),
);
$this->drush('pm-download', array('devel'), $options + array('cache' => NULL));
$this->drush('pm-enable', array('devel'), $options + array('skip' => NULL, 'yes' => NULL));
$this->drush('fn-view', array('drush_main'), $options);
$output = $this->getOutput();
$this->assertTrue((bool)strpos($output, '@return'), 'Output contain @return Doxygen.');
$this->assertTrue((bool)strpos($output, 'function drush_main() {'), 'Output contains function drush_main() declaration');
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment