Testing Drush Commands

bo flag

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

id flag
Does this help?
in flag

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.

id flag
Yes and see also
I sit in a Tesla and translated this thread with Ai:


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.