TravisCI PHPUnit Fatal Error - Call to undefined method PHPUnit_Util_Configuration :: getTestdoxGroupConfiguration ()

My TravisCI build does not work due to a fatal error referencing PHPUnit_Util_Configuration::getTestdoxGroupConfiguration() , although PHPUnit works without problems locally. I verified that Composer on TravisCI installs the same version of PHPUnit as the local one.

I noticed that a recent patch refers to the configuration of testdox groups, but I cannot understand why this change could break PHPUnit in TravisCI but not my local version.

Here is the composer from TravisCI:

 - Installing phpunit/phpunit (5.7.6) Downloading: 100% 

And here is a fatal error and a 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 
+5
source share
2 answers

The problem is the version mismatch between the global version of PHPUnit TravisCI and what Composer installs. Notice 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 refers to the / phpunit provider (in this case, version 5.7.6 refers to Composer), and the second line refers to the TravisCI global bin / phpunit (version 5.6.5). The patch in a later version probably violates something when you try to invoke something in the global version.

Updating .travis.yml to use vendor/bin/phpunit (plus any flags) to use the version installed by Composer fixes the problem. In particular, adding this line to .travis.yml (or, as in my case, changing the existing phpunit line), do the trick:

 script: - vendor/bin/phpunit [phpunit flags here] 
+9
source

Just add

 script: - vendor/bin/phpunit 

to your travis.yml file

+1
source

Source: https://habr.com/ru/post/1263414/


All Articles