Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call to undefined method doRun() #565

Open
unlikenesses opened this issue Mar 9, 2020 · 6 comments
Open

Call to undefined method doRun() #565

unlikenesses opened this issue Mar 9, 2020 · 6 comments

Comments

@unlikenesses
Copy link

unlikenesses commented Mar 9, 2020

Preconditions

  1. Bundle version 4.0
  2. PHP Unit version 7.5.20
  3. Symfony version 5.0.5
  4. PHP version 7.3.13
  5. My .env.test looks like this:
DATABASE_URL=sqlite:///%kernel.project_dir%/var/data/test.sqlite

and the test.sqlite database has been created and has the correct schema.

Steps to reproduce

After installing the bundle and running ./bin/phpunit, I get this error:

HP Fatal error: Uncaught Error: Call to undefined method PHPUnit\TextUI\TestRunner::doRun() in /app/bin/.phpunit/phpunit-7.5-0/src/TextUI/Command.php:206
Stack trace:
#0 /app/bin/.phpunit/phpunit-7.5-0/src/TextUI/Command.php(162): PHPUnit\TextUI\Command->run(Array, true)
#1 /app/bin/.phpunit/phpunit-7.5-0/phpunit(17): PHPUnit\TextUI\Command::main()
#2 /app/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php(343): include('/app/bin/.phpun...')
#3 /app/bin/phpunit(13): require('/app/vendor/sym...')
#4 {main}
thrown in /app/bin/.phpunit/phpunit-7.5-0/src/TextUI/Command.php on line 206

EDIT:

It works if you run ./vendor/bin/phpunit. So apparently it doesn't work with the bridge version.

@alexislefebvre alexislefebvre changed the title Call to undefined method Call to undefined method doRun() Jan 13, 2021
@ebuildy
Copy link

ebuildy commented Feb 5, 2024

This is broken from SF 4.4, running a fresh install

10005  symfony new my_project_directory --version="4.4.*"
10006  cd my_project_directory
10010  composer require --dev phpunit/phpunit symfony/test-pack
10014  ./bin/phpunit

Gives error:

Fatal error: Uncaught Error: Call to undefined method PHPUnit\TextUI\TestRunner::doRun() in my_project_directory/bin/.phpunit/phpunit-8.5-0/src/TextUI/Command.php:235
Stack trace:
#0 my_project_directory/bin/.phpunit/phpunit-8.5-0/src/TextUI/Command.php(194): PHPUnit\TextUI\Command->run(Array, true)
#1 my_project_directory/bin/.phpunit/phpunit-8.5-0/phpunit(22): PHPUnit\TextUI\Command::main()
#2 my_project_directory/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php(465): include('/Users/tdecaux/...')
#3 my_project_directory/bin/phpunit(13): require('/Users/tdecaux/...')
#4 {main}
  thrown in my_project_directory/bin/.phpunit/phpunit-8.5-0/src/TextUI/Command.php on line 235

@alexislefebvre
Copy link
Collaborator

@ebuildy You have this error without installing LiipFunctionalTestBundle?

@ebuildy
Copy link

ebuildy commented Feb 5, 2024 via email

@alexislefebvre
Copy link
Collaborator

Thanks for reporting it though, it gives an interesting insight on this error.

I can't find a call to doRun in this bundle, so I don't get what is the root cause of this error.

@ebuildy
Copy link

ebuildy commented Feb 5, 2024 via email

@ebuildy
Copy link

ebuildy commented Feb 7, 2024

OK got it!

In Symfony documentation, for 4.4 at https://symfony.com/doc/4.x/testing.html, they said:

composer require --dev phpunit/phpunit symfony/test-pack

But symfony bridge is using another version of phpunit, tuned by Symfony. So you dont need to install phpunit. composer remove phpunit/phpunit did the trick, no more mess between 2 phpunit versions

But your library requires phpunit, which is not compatible with symfony-phpunit bridge concept :-/

Please post your composer.lock content here so I could help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants