On the HackerNoon site Sameer Nyaupane has posted the second part of his series on test-driven development in PHP focusing on unit testing and sharing some best practices around creating effective tests.
All right, welcome to part 2 of “PHP Test Driven Development” series. Today we will go through the PHPUnit setup in detail.
We will be using the Laravel framework to make it easier for us to get started. It will also help me to show you how to do testing for real life applications. I will assume you have used Laravel before. This will help me focus on the testing side and make the tutorial easier to grasp.
The tutorial then walks you through the setup of a new Laravel project and the inclusion of PHPUnit before getting into the tests themselves. It also shares a PHPUnit configuration example and the creation of an example tests with a simple assertion.