Symfony-docs: PHPUnit require when using phpunit bridge

Created on 30 Dec 2018  路  7Comments  路  Source: symfony/symfony-docs

Hello!

Currently creating an app on symfony4 and writing tests on it. As in the manual, we should require symfony/phpunit-bridge and be happy. But if I require only phpunit-bridge, I won't be able to use features of phpunit, because it is not required with it. So, if I wanna use PHPUnit/Framework/TestCase (as it normally does, and as the documentation of Symfony requries too), it is imposible due to the lack of files. Also, It is hard to assign phpunit to phpstorm to use from the ui.

So it might be usefull to add additional requirement in composer?
Or is it just for me?

Testing

Most helpful comment

Is this really how it is supposed to be?
[...]
because installing phpunit to vendor/bin/.phpunit does not help with my autocompletion

It works fine on my machine鈩笍 (Symfony 5.0.8, PHPUnit 9.0) with PhpStorm 2020.1.1 (Build #PS-201.7223.96, built on April 30, 2020). Have you tried invalidating the PhpStorm caches?

All 7 comments

Running your tests afterwards with the simple-phpunit script will install PHPUnit. Afterwards, auto-completion should work as well. We may want to add a call of vendor/bin/simple-phpunit install before explaining how to write tests. That should probably help with some confusion.

Or just add phpunit as a dependency to this bridge, because it is the way, it has to work.

Also note that you can install PHPUnit dependencies to provide auto-completion without running your tests with the following command:

./vendor/bin/simple-phpunit install

Or when using Flex:

./bin/phpunit install

Ops, I just noticed that I missed the install part in my previous comment. I just updated it.

Hey 馃憢

Is someone working on adding a note about installing PHPUnit by using the install command of the binary?

If not, I would like to try my luck on it. 馃槈

Is this really how it is supposed to be?

vendor/bin/simple-phpunit install
Creating a "phpunit/phpunit" project at "./phpunit-7.5-0"
Installing phpunit/phpunit (7.5.20)
Plugins have been disabled.

  • Installing phpunit/phpunit (7.5.20): Downloading (100%)
    Created project in /home/user/code/test/vendor/bin/.phpunit/phpunit-7.5-0`

because installing phpunit to vendor/bin/.phpunit does not help with my autocompletion

Is this really how it is supposed to be?
[...]
because installing phpunit to vendor/bin/.phpunit does not help with my autocompletion

It works fine on my machine鈩笍 (Symfony 5.0.8, PHPUnit 9.0) with PhpStorm 2020.1.1 (Build #PS-201.7223.96, built on April 30, 2020). Have you tried invalidating the PhpStorm caches?

Was this page helpful?
0 / 5 - 0 ratings