Unit Testing (or other testing methodologies) is one of those things that’s often relegated to larger software applications or enterprise-level projects and seems to be often overlooked in the context of WordPress.
Why is that?
WordPress is a web application and the tools, themes, plugins, and extensions that we build are software that run on top of said platform and the platform as well as the certain themes and/or plugins can be used anywhere from just a few hundred people up to several million people.
In some cases, I think this qualifies it as enterprise-grade. Regardless, WordPress should not be excluded from the best practices in software development. As such, I’m contributing a series of articles on Envato that is meant to help you get started with WordPress unit testing.
It’s targeted at beginners but aims to lay a foundation on which more experienced developers can build. Additionally, I’m providing working examples of plugins and themes both of which have been built using unit tests:
Throughout the series, I walk you through how to setup your local development environment to include both PHPUnit and the WordPress Testing framework along with giving a background of unit testing, what it is, why it matters, how it can improve plugin architecture and theme development.
All of the code is also available on my GitHub page:
- Hello Reader is a sample plugin
- Basic Theme is a sample theme
Leave a Reply
You must be logged in to post a comment.