PHPUnit is a unit testing framework written in and for PHP.
What is unit testing?
Unit testing is the practice of testing particular functions or classes to ensure that they behave as expected. Think of it as an automated test run of your code.
Is unit testing really useful?
Unity testing is useful for any projects but small ones. It is extremely easy to run and re-run all your tests the moment you or a co-worker have finished implementing a new feature, and this can be done in the background while you work on another feature or project.
It is not as effective with smaller projects because these are usually easy and quick to test anyway, and the time spent writing the tests would not be futile.
But you can’t test output, can you?
How easy is PHPUnit to use?
It is incredibly easy to use. The documentation provides examples that can be mimicked or played with after copying and pasting. Writing tests from scratch requires only reading the appropriate sections of the documentation. PHPUnit provides an in-depth framework that is simple and easy to understand thanks to the documentation.
But how well documented is it?
The PHPUnit documentation is very extensive, with plenty of examples and explanations given along the way. Some important sections are even linked directly from the home page to make it easy to get started.
So go on, explore PHPUnit and start testing your code!