1

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!

1 Answer 1

4

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.

Sign up to request clarification or add additional context in comments.

3 Comments

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
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
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.