Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
..
Failed to load latest commit information.
Drush/Tests/Make/Parser
Unish
hooks/magic_help_alter
makefiles
resources
COVERAGE.txt
README.md
annotatedCommandTest.php
backendTest.php
backendUnitTest.php
batchTest.php
bootstrap.inc
cacheCommandTest.php
commandSpecificTest.php
commandTest.php
commandUnitTest.php
completeTest.php
completetest.drush.inc
completetestsite.drush.inc
configPullTest.php
configTest.php
contextTest.php
coreTest.php
devel.xml
drushScriptTest.php
expandWildcardTablesUnitTest.php
filesystemTest.php
generateMakeTest.php
imageTest.php
initCommandTest.php
lockMakeTest.php
makeConvertTest.php
makeTest.php
outputFormatUnitTest.php
phpunit.xml.dist
pmDownloadTest.php
pmEnDisUnListInfoTest.php
pmReleaseNotesTest.php
pmRequestTest.php
pmRequestUnitTest.php
pmUpdateCodeTest.php
pmUpdateStatusTest.php
queueTest.php
quickDrupalTest.php
releaseInfoTest.php
roleTest.php
shellAliasTest.php
siteAliasTest.php
siteAliasUnitTest.php
siteSetTest.php
siteSetUnitTest.php
siteSshTest.php
sqlConnectCreateTest.php
sqlDumpTest.php
sqlSyncTest.php
tablesUnitTest.php
testChildren.sh
unit.drush.inc
userTest.php
watchdogTest.php
xhUnitTest.php

README.md

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

Usage

  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: unish.sh

Advanced usage

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

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 - http://drupalcode.org/project/devel.git/blob/refs/heads/8.x-1.x:/run-tests-drush.sh

Cache

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.