liip / LiipFunctionalTestBundle

Some helper classes for writing functional tests in Symfony
http://liip.ch
MIT License
639 stars 182 forks source link

Call to undefined method doRun() #565

Open unlikenesses opened 4 years ago

unlikenesses commented 4 years ago

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.

ebuildy commented 7 months ago

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 commented 7 months ago

@ebuildy You have this error without installing LiipFunctionalTestBundle?

ebuildy commented 7 months ago

Ho yeah totally unrelated, 😔

Le lun. 5 févr. 2024, 10:39, Alexis Lefebvre @.***> a écrit :

@ebuildy https://github.com/ebuildy You have this error without installing LiipFunctionalTestBundle?

— Reply to this email directly, view it on GitHub https://github.com/liip/LiipFunctionalTestBundle/issues/565#issuecomment-1927281127, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJJZ2LZPNJXPWNTX5UNLDDYSD4KDAVCNFSM4LEK7Z2KU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJSG4ZDQMJRGI3Q . You are receiving this because you were mentioned.Message ID: @.***>

alexislefebvre commented 7 months ago

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 commented 7 months ago

Looks like symfony is doing some shit with their phpunit bridge , this drive me nuts

Le lun. 5 févr. 2024, 11:06, Alexis Lefebvre @.***> a écrit :

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.

— Reply to this email directly, view it on GitHub https://github.com/liip/LiipFunctionalTestBundle/issues/565#issuecomment-1927337791, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJJZ2KHJWE2DKH5EDVND7LYSD7QLAVCNFSM4LEK7Z2KU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJSG4ZTGNZXHEYQ . You are receiving this because you were mentioned.Message ID: @.***>

ebuildy commented 7 months ago

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