Let’s start to play by trying and doing
Developers who depend heavily on unit tests use a technique known as “test-driven development,” or TDD.
TDD is a software development process whereby you write tests before you implement code. So, the tests guide the developer to write the code itself. TDD is a cyclical process, with 4+1 steps: write tests, write code, refactor, test again, and repeat the process again.
PHP TDD Tools
There are many tools that can be of great help in TDD with PHP.
PHPUnit ( ...