I'm trying to set up drush + phpunit, following these two guides:

Here's what I have so far:

  • macOS Sierra 10.12.2
  • PHPUnit 5.7.5 at /users/wim.mostrey/.composer/vendor/bin/phpunit
  • Drush 8.1.9 at /users/wim.mostrey/.composer/vendor/bin/drush
  • Drush tests at /users/wim.mostrey/.composer/vendor/drush/drush/tests
  • a simple test migrateManifestTest at /users/wim.mostrey/.composer/vendor/drush/drush/tests/migrateManifestTest.php

I try to run the test using the following command:

UNISH_NO_TIMEOUTS=1 UNISH_DRUPAL_MAJOR_VERSION=8 ./unish.sh --filter=migrateManifestTest

However I get the following error:

PHP Fatal error:  Class 'Unish\UnitUnishTestCase' not found in /Users/wim.mostrey/.composer/vendor/drush/drush/tests/bootstrap.inc on line 51

I tried searching online for this error but got no results at all. I tried running both unish.sh and phpunit from different locations and using different configuration options, to no avail.

Any help would be highly appreciated.

1 Answer 1


Alright so here's what I did, with help from MegaChriz.

The dev dependencies for Drush need to be installed and the phpunit version that comes with Drush should be used instead of a 'general' phpunit. So not the one I installed through composer.

  1. Git clone of Drush from my home folder (/users/wim.mostrey)

    git clone https://github.com/drush-ops/drush.git
    cd drush
    git checkout 8.1.9
  2. Install Drush with dev dependencies using Composer while being inside the Drush folder

    composer install
  3. Execute built-in tests pointing to the phpunit version from Drush:

    UNISH_NO_TIMEOUTS=1 /users/wim.mostrey/drush/vendor/bin/phpunit --configuration /users/wim.mostrey/drush/tests --filter=ImageCase

    or for Drupal 7 tests:

    UNISH_NO_TIMEOUTS=1 UNISH_DRUPAL_MAJOR_VERSION=7 /users/wim.mostrey/drush/vendor/bin/phpunit --configuration /users/wim.mostrey/drush/tests /users/wim.mostrey/Sites/drupal7/sites/all/modules/feeds/tests/drush

Great success

Your Answer

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

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