Search code examples
composer-phpsymfony4

How to install phpUnit in Symfony4 / Symfony5?


When I install phpUnit directly with composer req phpunit/phpunit I get a warning message:

Adding phpunit/phpunit as a dependency is discouraged
in favor of Symfony's PHPUnit Bridge.

  * Instead:
    1. Remove it now: composer remove --dev phpunit/phpunit
    2. Use Symfony's bridge: composer require --dev phpunit

So I do as the message says, but after composer require --dev phpunit it installs the symfony/test-pack which only install the Panther and the phpUnit bridge, but the phpUnit itself is nowhere to be seen.

How to install phpUnit in Symfony4 properly?


Solution

  • I ran the vendor/bin/simple-phpunit script by accident, and turns out it downloads the phpUnit library locally when executed.