Category: Archive

  • Common Unit Test Issues in WordPress

    A list of the most common issues encountered when writing WordPress unit tests. Includes workarounds for the most common automated testing problems.

  • Understanding WordPress PHP Unit Test Fixture Setup and Teardown

    When I get started writing unit tests in WordPress, I continuously ran into what seemed to be strange behaviours by the WordPress Unit Testing framework. Strange when comparing to other PHP unit tests anyway. It wasn’t until I read all the code of the bootstrap and install scripts, as well as the base WordPress unit test case,…

  • WP_UnitTest_Factory: The Missing Documentation

    The WP_UnitTestCase class has a factory() method that gives access to the WP_UnitTest_Factory factory classes. And it’s these classes that you use to create data objects (called fixtures) like posts, users, or terms in your tests. So here is an example that creates a post: But there’s more–you can use the WP_UnitTest_Factory class to create:…

  • How To Make Your Code More Readable By Using Early Returns

    A step by step refactoring of a function to use early returns. This technique makes the code easier to read and understand.

  • Code Review Checklist

    Code review has been an integral part of my career as a developer. Whether it in the beginning through reviewing themes for WordPress.org, reviewing client code at WordPress.com VIP, or now when reviewing code from peers as a Principal Engineer at Human Made. Code review has both allowed me to learn and grow as an…

  • WordPress Coding Standards for PHP_CodeSniffer: Frequently Asked Questions

    Have any question about the WordPress Coding Standards for PHP_CodeSniffer? We’ve answered the most common questions in the simplest way.