How to test custom implemented Drush Commands ? Are there any Open Source Examples for Drush Commands with Unit Tests or something like that ?


1 Answer 1


There are a few test traits from drush package, that you can re-use.

As an example check the migration_tools module. It contains a few PHPUnit tests for drush commands:

In addition you can have a look at tests inside the drush package.


As @cilefen mentioned in the comment, there is a documentation section about unit tests at drush github page.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.