I’ve written a lot about object-oriented PHP and more specifically dependency injection and using classes to encapsulate functionality with a simple public API. By using the object-oriented programming features of PHP this way, you can write unit and integration tests so that you whenever you make changes to the class, you know that given the same inputs, the output of the class is consistent.

That all sounds great, but dealing with inputs is tricky. This is especially true when taking an object-oriented approach to working with WordPress. In this article, we’ll look at a common problem when writing WordPress code — …read more