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


the official Drush/tests/README.md
Getting Started Testing Drush Commands which is the most recent guide I could find


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.
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.


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

Install Drush with dev dependencies using Composer while being inside the Drush folder

composer install

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