O'Reilly logo

Getting Started with Laravel 4 by Raphaël Saunier

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Unit testing with PHPUnit

A positive effect of testing is that it forces you to split your code into manageable dependencies so you can test them in isolation. The testing of these individual classes and methods is referred to as unit testing. Since it relies on the PHPUnit testing framework, which already provides a large number of tools to set up test suites, Laravel does not need to provide any additional helpers for this type of testing.

A great way to learn about any framework, and at the same time learn about the different ways in which it can be tested, is to look at how its authors have written tests for it. Therefore, our next examples will be taken directly from Laravel's test suite, which is located at vendor/laravel/framework/tests/ ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required