Drupal Association members fund grants that make connections all over the world.
Updated: Comment #65
Standard methods of running PHPUnit-based tests for contrib modules do not work.
PHPUnit finds all the test classes within
/sites/*/modules, but none of the classes in those folders are loaded by the autoloader.
Subsequently, running any PHPUnit tests on contrib modules will fail when those tests attempt to load classes from namespaces that have not been registered (including the module's own). This goes for both the QA infrastructure on drupal.org as well as standard PHPUnit command line invocations (like
cd core; ./vendor/bin/phpunit and IDE integrations.
/core/tests/bootstrap.php so that it finds and registers all the relevant namespaces outside of core.
User interface changes
Original report by Mile23
I copied the file directory structure and namespacing conventions from Views into my contrib module.
I did the following:
cd core ./vendor/bin/phpunit
PHPUnit is unable to find my tests. I have no idea whether the autoloader is broken or I'm doing something wrong.
Is there a clear explanation somewhere for how to setup a PHPUnit-based test for a contrib module in Drupal 8?
BTW: There is no component setting for 'testing' in the issue system.
PASSED: [[SimpleTest]]: [MySQL] 58,636 pass(es). View
PASSED: [[SimpleTest]]: [MySQL] 59,192 pass(es). View
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch drupal-phpunit_bootstrap_contrib-2025883-65.patch. Unable to apply patch. See the log in the details link for more information. View