Setting up and configuring PHPUnit
In this recipe, we'll see how to install and setup the popular PHPUnit testing package: PHPUnit.
Getting ready
For this recipe, we need a working installation of Laravel 4. We'll also need the Composer dependency tool installed from http://getcomposer.org.
How to do it...
To complete this recipe, follow the given steps:
In the root directory of the application, add the following line to the
composer.json
file:"require-dev": { "phpunit/phpunit": "3.7.*" },
Open the command line window, navigate to the root directory, and run an update on the Composer tool with the following line:
php composer update
After it is installed, run a quick test in the command line window with the command:
vendor/bin/phpunit
How it works...
Our composer.json
file tells the Composer tool which packages it should install. So our first task is to add the phpunit
package as a requirement. After saving that file, we'll run an update
command and phpunit
will be added to our vendor...