I'm working on an 8.x module that uses PHPUnit tests. I've been running these from the command line using the embedded phpunit script that's installed with Drupal 8:
../vendor/bin/phpunit PATH/TO/MY/FILE.php
Both of my tests work w/o any problems under both PHP 5.5 and PHP 5.6.
But the Drupal testbot is failing both of my tests with the error
Fatal error: Trait 'Drupal\Tests\my_module\MockSessionTrait' not found in /var/www/.../PATH/TO/MY/FILETest.php
Using phpunit from the command line, this same trait is found w/o any trouble.
If I run the tests myself from the command line, but this time using run-tests.sh, I get the same error the testbot gets:
php scripts/run-tests.sh --url http://192.168.88.42/drupal --class 'Drupal\Tests\my_module\Unit\FILETest'
The stack trace looks like this:
PHP Stack trace:
PHP 1. {main}() /var/www/drupal/core/scripts/run-tests.sh:0
PHP 2. simpletest_script_get_test_list() /var/www/drupal/core/scripts/run-tests.sh:76
PHP 3. class_exists() /var/www/drupal/core/scripts/run-tests.sh:807
PHP 4. spl_autoload_call() /var/www/drupal/core/scripts/run-tests.sh:807
PHP 5. Symfony\Component\ClassLoader\ApcClassLoader->loadClass() /var/www/drupal/core/scripts/run-tests.sh:0
PHP 6. require() /var/www/drupal/vendor/symfony/class-loader/ApcClassLoader.php:114
I'm guessing that I need to help run-tests.sh to find my files, somehow.
Any advice from anyone as to why run-tests.sh behaves differently here from stock phpunit?