Reputation: 343
I'm working with Symfony 5 and I installed phpunit-bridge with the command included in the documentation : composer require --dev symfony/phpunit-bridge
.
When I run phpunit with this command, php bin/phpunit
, I have this error :
PHP Fatal error : Uncaught Error: Call to undefined method PHPUnit\TextUI\TestRunner::doRun()
Upvotes: 2
Views: 2237
Reputation: 704
I had a similar issue with symfony 5.1. I tried upgrading all dev packages related to testing but it didn't work. Once I completely remove all dev (testing related) packages and reinstalling the symfony phpunit bridge package it worked. You have to remove the phpunit file inside the root/bin directory
Steps to follow
composer remove symfony/browser-kit
) composer require --dev symfony/phpunit-bridge
Upvotes: 0
Reputation: 159
I'll try to guess.
You also have a bundle like liip/functional-test-bundle
or other, which require PHPUnit in requirements (or even you require PHPUnit directly in your composer.json
together with phpunit-bridge
).
As a result you have two different version of PHPUnit installed in project, with two different api.
If installed liip/functional-test-bundle
is your case and you do not want to remove it, you need to install by bridge same PHPUnit version as installed by Liip bundle dependency. You can set version through SYMFONY_PHPUNIT_VERSION
env variable or directly in bin/phpunit
file. Or you can redefine path to already installed PHPUnit version (in vendors/) through SYMFONY_PHPUNIT_DIR
env or directly in bin/phpunit
.
Note: you can not set SYMFONY_PHPUNIT_VERSION
or SYMFONY_PHPUNIT_DIR
through .env.* files, since bin/phpunit
not read this files. So it should be real env vars.
Upvotes: 3