Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

pedroroccon's avatar

PHPUnit not running from vendor/bin folder (Composer install)

Greetings,

I have my application setted up and everything is working, but when I try to test using my PHPUnit file (inside the vendor/bin folder), it returns me:

You need to set up the project dependencies using Composer:

    composer install

You can learn all about Composer on https://getcomposer.org/.

Anyone knows what i'm doing wrong? I'm using the command: vendor/bin/phpunit vendor/pedroroccon/my-package to execute the tests

0 likes
2 replies
diegoaurino's avatar
Level 39

Hello, @pedroroccon !

What happens if you run composer install?

Are you running PHPUnit from the command line or from an IDE?

Check if your IDE is configured to use the proper phpunit.xml from the project's root folder and the autoload.php included in the /vendor folder. Also, check if you are calling PHPUnit from /vendor/bin/phpunit included in your app installation and not from other installation or even from a global installation on your OS in case you are using the command line.

And what do you mean by you are using vendor/bin/phpunit vendor/pedroroccon/my-package? Are you using PHPUnit to run a folder you placed inside the /vendor directory? If so, I am afraid your default PHPUnit configuration will not understand this. 

Hope this helps. Let me know.

pedroroccon's avatar

@diegoaurino I'm running the PHPUnit from a command line. I solved the problem updating my local installation of PHPUnit and running directly from the base installation instead of /vendor/bin/phpunit.

I'm doing phpunit vendor/pedroroccon/my-package instead of vendor/bin/phpunit vendor/pedroroccon/my-package

When I execute composer install it gives me a message telling that everything is up-to-date.

Althought thanks for helping me!

Please or to participate in this conversation.