Find file
30 lines (25 sloc) 1.42 KB

Drush's test suite is based on PHPUnit. In order to maintain high quality, our tests are run on every push by Travis


  1. Review the configuration settings in tests/phpunit.xml.dist. If customization is needed, copy to phpunit.xml and edit away.
  2. Run unit tests:

Advanced usage

  • Run only tests matching a regex: --filter=testVersionString
  • Skip slow tests (usually those with network usage): --exclude-group slow
  • XML results: --filter=testVersionString --log-junit results.xml
  • Use an alternate version of Drupal: UNISH_DRUPAL_MAJOR_VERSION=8 ...
  • Skip teardown (to examine test sites after a failure): UNISH_DIRTY=1 ...

Reuse by Drush Commandfiles

Drush commandfiles are encouraged to ship with PHPUnit test cases that extend UnitUnishTestCase and CommandUnishTestCase. In order to run the tests, you have to point to the phpunit.xml file that used by Drush. The devel project has a wrapper script which demonstrates this -


In order to speed up test runs, Unish (the Drush testing class) caches built Drupal sites and restores them as requested by tests. Once in while, you might need to clear this cache by deleting the /drush-cache directory.