The anatomy of a test

Your application tests will reside in tests/. In this directory, you will find a base test case inside TestCase.php, which is responsible for bootstrapping the application in the testing environment. This class extends Laravel's main TestCase class, which in turn extends the PHPUnit_Framework_TestCase class, along with many helpful testing methods that we will cover later in this chapter. All of your tests will extend this first TestCase class and define one or more methods that are meant to test one or more features of your application.

In every test, we generally perform the following three distinct tasks:

  1. We arrange or initialize some data.
  2. We execute a function to act on this data.
  3. We assert or verify that the output matches ...

Get Laravel 5 Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.