Unit tests

We would be remiss if we did not mention unit tests in this chapter. Unit testing is a method by which individual units of source code are tested to determine if they are fit for use. Remember from the beginning of the book how we recommended that you write your code in "units"? This is where it all comes together: units of code should be a size that makes them easy to test.

There are a couple of testing frameworks available for PHP that help you write unit tests. It's beyond the scope of this book to demonstrate their use, but we encourage you to look into them if your plugin is getting complicated and difficult to maintain. Unit tests are a real lifesaver because they help you catch any place where your code has failed. All of the ...

Get WordPress 3 Plugin Development Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.