My TravisCI build is failing due to a fatal error referencing PHPUnit_Util_Configuration::getTestdoxGroupConfiguration()
even though PHPUnit runs without issue locally. I've verified that Composer on TravisCI is installing the same version of PHPUnit as what I've installed locally.
I noticed that a recent patch references testdox groups configuration specifically, but I can't figure out why that change might have broken PHPUnit within TravisCI but not my local version.
Here's the Composer from TravisCI:
- Installing phpunit/phpunit (5.7.6) Downloading: 100%
And here's the fatal error and stack trace from TravisCI:
PHP Fatal error: Call to undefined method PHPUnit_Util_Configuration::getTestdoxGroupConfiguration() in /home/travis/build/twistofreality/dilmun/vendor/phpunit/phpunit/src/TextUI/TestRunner.php on line 1042
PHP Stack trace:
PHP 1. {main}() /home/travis/.phpenv/versions/5.6.5/bin/phpunit:0
PHP 2. PHPUnit_TextUI_Command::main() /home/travis/.phpenv/versions/5.6.5/bin/phpunit:722
PHP 3. PHPUnit_TextUI_Command->run() phar:///home/travis/.phpenv/versions/5.6.5/bin/phpunit/phpunit/TextUI/Command.php:104
PHP 4. PHPUnit_TextUI_TestRunner->doRun() phar:///home/travis/.phpenv/versions/5.6.5/bin/phpunit/phpunit/TextUI/Command.php:152
PHP 5. PHPUnit_TextUI_TestRunner->handleConfiguration() /home/travis/build/twistofreality/dilmun/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:163
The problem is a version mismatch between the global TravisCI version of PHPUnit and what Composer is installing. Note the last two lines of the stack trace:
PHP 4. PHPUnit_TextUI_TestRunner->doRun() phar:///home/travis/.phpenv/versions/5.6.5/bin/phpunit/phpunit/TextUI/Command.php:152
PHP 5. PHPUnit_TextUI_TestRunner->handleConfiguration() /home/travis/build/twistofreality/dilmun/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:163
The last line references vendor/phpunit (in this case, version 5.7.6, per the Composer output), whereas the second to last line references TravisCI's global bin/phpunit (version 5.6.5). It's likely the patch in the more recent version breaks something when trying to call something in the global version.
Updating .travis.yml to use vendor/bin/phpunit
(plus whatever flags) to use the version installed by Composer fixes the issue. Specifically, adding this line to .travis.yml (or, as in my case, modifying the existing phpunit line), will do the trick:
script:
- vendor/bin/phpunit [phpunit flags here]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With