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
Written by Juan
Related protips
1 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.
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Php
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#