Unit testing is a way of testing a unit, the smallest piece of code, that can be logically isolated in a system. These units are tested against expected results.
In object-oriented programming, a unit is often an entire interface, such as a class, but could be an individual method. In procedural programming, a unit may be an individual program, function, procedure, etc. Unit testing is done to ensure that the source code written by the developer meets the requirement and behaves in an expected manner.
PHPUnit is a programmer-oriented testing framework for PHP.