Book Review: PHPUnit Essentials

September 1, 2014

In the past few years I have worked on many projects that involved implementing a testing infrastructure, I have spoken at conferences on the important of and theories of testing, and I have led workshops training beginners in testing. In all that time I have looked for a good concise and easy to read resource to share with people. PHPUnit Essentials by Zdenek Machek meets and exceeds my expectations.

Machek starts the book out by walking through the available installation methods and then moves into tools, in particular IDEs. Several popular open source and commercial IDEs are reviewed including: NetBeans, Zend Studio, Eclipse, and PhpStorm. Machek walks through the process of setting up PHPUnit in each IDE and running simple tests to get you started.

Machek goes into the basics of testing but the real power of this book lies in the thorough review of the more advanced testing concepts that many resources shy away from. Starting with theory on how to write good testable code all the way to testing databases, the following topics are covered: dependencies, in depth command line usage, test isolation, dealing with globals and data providers, test organization, test doubles (fakes, stubs, mocks, expectations, and proxies), database testing, API testing, and testing legacy (spaghetti) code. As a bonus Machek tossed in chapters on functional tests in the web browser, continuous integration, behavior-driven testing, and even a section on PHPUnit alternatives.

This is a small book but it is packed with a powerful amount of information and excellent code examples. It is a must have on any PHP developers bookshelf.

 

Legal Stuff

Disclosure of Material Connection: I received this book free from the publisher Packt Publishing. I was not required to write a positive review. The opinions I have expressed are my own.

If you would like me to review your book head over to the contact page and get a hold of me.

Leave a Reply

Your email address will not be published. Required fields are marked *