03.12.2015 Views

laravel4cookbook

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Controller Testing 351<br />

1 composer require --dev "phpunit/phpunit:4.0.*"<br />

2<br />

3 ./composer.json has been updated<br />

4 Loading composer repositories with package information<br />

5 ...<br />

6<br />

7 composer require --dev "mockery/mockery:0.9.*"<br />

8<br />

9 ./composer.json has been updated<br />

10 Loading composer repositories with package information<br />

11 ...<br />

We’ll get into the specifics of each later, but this should at least install them and add them to the<br />

require-dev section of your composer.json file.<br />

Unit vs. Functional vs. Acceptance<br />

There are many kinds of tests. There are three which we are going to look at:<br />

1. Unit<br />

2. Functional<br />

3. Acceptance<br />

Unit Tests<br />

Unit tests are tests which cover individual functions or methods. They are meant to run the functions<br />

or methods in complete isolation, with no dependencies or side-effects.<br />

.<br />

You can find a boring description at: http://en.wikipedia.org/wiki/Unit_testing.<br />

http://en.wikipedia.org/wiki/Unit_testing<br />

Functional Tests<br />

Functional tests are tests which concentrate on the input given to some function or method, and the<br />

output returned. They don’t care about isolation or state.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!