Last Updated: March 15, 2017
· jamart

Install PHPunit with Composer

You can install PHPUnit as a local, per-project dependency with Composer. You can find more information in the PHPUnit's Github repo, you need put this dependency in the composer.json:

    "require-dev": {
        "phpunit/phpunit": "3.7.*"

Now you need update your dependencies:

composer update

It installs all PHPunit dependencies, and now you have a phpunit executable in [yourprojectdir]/vendor/bin/phpunit. If

for example you want to test the file SampleTest.php in the root of your project and you are in in the root of your project you can write in terminal:

vendor/bin/phpunit SampleTest.php
Say Thanks

1 Response
Add your response


Nice tutorial for installing PHPUnit 3.7. I have found this article that details how to install PHPUnit 5.5 and using PHPUnit for unit testing PHP app.

8 months ago ·