I’ve become quite obsessive about unit testing recently, and in particular the PHPUnit testing framework. A big proponent of test-driven development is Martin Fowler, and I keep one of his quotes in a sticky note on my desktop as a little reminder:
Whenever you are tempted to type something into a print statement or a debugger expression, write it as a test instead.
The PHPUnit manual is really well written, and contains a great guide for writing your first tests.