liip / LiipFunctionalTestBundle

Some helper classes for writing functional tests in Symfony

Home Page:http://liip.ch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Call to undefined method doRun()

unlikenesses opened this issue · comments

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.

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

@ebuildy You have this error without installing LiipFunctionalTestBundle?

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.

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