I have a fresh symfony project and I need to install phpunit, so I run composer require --dev symfony/phpunit-bridge to install it. It creating symlink to phpunit executable in bin/ folder. But when I'm running tests using bin/phpuinit tests/ command I'm getting message "No composer.json found in the current directory, showing available packages from packagist.org
" and it starting phpunit installation into bin directory and at the end I have bin/.phpunit folder and all the phpunit related files there. Why it installing php unit there and not into vendor, why it's not see composer??? what I'm doing wrong ? Thanks in advance!
Add a comment
|
1 Answer
What you are using is the symfony/phpunit-bridge
It basically is way more flexible than just phpunit in the vendor folder, allowing to adapt to multiple versions of PHPUnit based on your environment.
Please read the documentation linked above for more details. You're not doing anything wrong!
Another way would be a plain composer require phpunit/phpunit, which would work the "basic"/"standard" way.
3 Comments
Bogdan Dubyk
so you mean it 's okay to have it installed into bin folder??? all dependencies should be in the vendor folder. What I have right now is gyazo.com/b5cc92c3d977bfcf63be4d741018fd3b . it's a bit strange
Bogdan Dubyk
also because of this I have issue with phpstan linter, it telling that "Class PHPUnit\Framework\TestCase not found." is not found and ide highlighting that php unit related files not exists
Thomas Dutrion
As previously stated it is normal when using symfony/phpunit-bridge. If you do not want this behaviour, remove phpunit-bridge and require phpunit/phpunit.