• At iThemes we officially support the latest and previous WordPress version for our plugins. This means we end up running our automated test suite across three versions, for instance right now we’re testing against WordPress 5.4, 5.5 and 5.6-beta.

    Sometimes when WordPress makes a change, we need to write tests to ensure compatibility. But it only makes sense to run these tests when we’re testing on that new WordPress version. If you are running unit tests this can be fairly straightforward.

    (more…)
  • At iThemes we use Codeception / WP-Browser to run our automated tests. I’ve described our setup in more detail in an earlier blog post, but the important bit to know for this post is that we use the Official WordPress Docker image as the base of our tests.

    The WordPress docker image only creates tags when new versions are officially released which made running our tests on beta releases difficult. To solve this, we need to figure out a way to upgrade the installed WordPress version before our tests run. There are a couple of ways we could go about this.

    (more…)
  • This year I’ve started to use Codeception as an alternative to vanilla PHPUnit for testing WordPress plugins. I’m using the fantastic WP-Browser library written by Luca Tumedei. It makes writing WordPress acceptance tests sane by providing a suite of Codeception Modules to load WordPress and simulate WordPress APIs.

    At iThemes we host all of our repositories on Bitbucket which made Bitbucket Pipelines a natural choice for automatically running our Codeception tests on commit. Getting everything up and running took a bit of work and wasn’t always straightforward. I intend for this post to be a guide to testing WordPress plugins with Codeception on Bitbucket Pipelines that’ll hopefully save you some time if you’re trying to set this up for yourself.

    (more…)
  • JSON Schema is a draft IETF specification that provides a vocabulary that allows you to annotate and validate JSON documents – json-schema.org. The WordPress REST API utilizes this system for describing the request and response formats for each endpoint. The schema for any endpoint can be seen by making an OPTIONS request to the endpoint.

    (more…)

  • Last year I wrote about developing  custom tables in WordPress using my library IronBound-DB.

    Custom Tables in WordPress

    Today I’m releasing the beta of version 2.0 of that library which brings a lot of changes to make the library a lot easier to work with. It’s modeled after Laravel’s Eloquent – an Active Record pattern.

    (more…)