Anyone who knows me knows that I’m a huge fan of unit testing. At least in theory. Unit testing is something that sounds great, and is great – if your tests are already written. But it sucks if you’re trying to build a test suite. In fact, building a test suite is one of the hardest things a programmer can do. It’s probably why I’m really bad at it (despite my advice to build one anyway).
Part of my problem has always been that I never really understood how to use the tools that are offered by PHPUnit. As a result, I’ve avoided writing tests for a long time.
Enter The Grumpy Programmer’s PHPUnit Cookbook. This book, by testing guru Chris Hartjes, covers all the major highlights of using PHPUnit to it’s fullest. It only took me a page to learn something new – I think a record in a book. The book is well-written, highly focused, and gets straight to the point with a minimum of fluff or fuss.
As an experiment, I took a couple chapters out of The Grumpy Programmer’s PHPUnit Cookbook and applied the principles to a project that I had already built. I followed the advice and I found writing tests to be a highly productive experience – far more productive than it had been before I read the book.
I believe this book is so good that I plan to recommend it as reading for students who are taking The Object Oriented PHP Masterclass. I believe that this book will compliment the efforts of any developer trying to cultivate an understanding of object oriented PHP and development best practices.
The Grumpy Programmer’s PHPUnit Cookbook is on sale now, direct from Chris Hartjes as an electronic book. Pick up a copy today and start writing the tests you’ve been missing!
Chris and I traded copies of our books for an in-kind exchange. I received no inducement or benefit from writing this review. I am not receiving any affiliate revenue from this review. This review is my opinion, and was written wholly without input from any other person.