Test driven development with Zend Framework
Test Driven Development (TDD) is a software development process that consist in writing unit tests for functionality that is going to be needed and once the test fails writing the code to make it pass. This process is repeated for every new feature or bug.
The most used tool for running unit tests for PHP applications is PHPUnit and is the one we are going to use. We are not going to go through the process of installation in this article.
Organizing tests
We will start by creating a folder for our tests. We probably already have a tests folder in our application root. If we didn’t have it we would have to create it. Inside that folder we are going to create two folders called models and controllers.
Our main suite will allow us to run all our tests with only one command. To create this suite we will create a file TestsSuites.php in our tests folder. This file will allow us to run all our application tests.