How Are Y'All Unit Testing Your WordPress Code (If You Are)

This page summarizes the projects mentioned and recommended in the original post on /r/ProWordPress

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • wp_mock

    WordPress API Mocking Framework

  • There is an effort called WP_Mock started by GoDaddy which attempts to mock the WordPress API, thus doing what I just accused the official version of testing of getting wrong. And this also feels wrong. Running tests against a mock of WordPress' API feels insufficient except for the simplest cases. Also if I'm not actually "testing against WordPress" I don't get the benefits of the official way, like being able to easy test against future and past versions of WordPress. I'm just testing against whatever version the mock attempts to replicate.

  • bh-wp-bitcoin-gateway

    Self-custody Bitcoin payment gateway for WooCommerce. Bitcoin is paid directly into your wallet. Transactions are verified using public APIs. No private keys are stored on the server. No account is needed with any third party.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • wp-phpunit

    WordPress core PHPUnit library. [READ ONLY] Versions for new WordPress releases are built daily.

  • First and foremost - I prefer end to end testing with tools like cypress or phpunit+browserkit over integration testing with the core test suite you linked. If I do reach for the core test suite lately I like the wp-phpunit package instead of the script you get from the wp-cli scaffolding.

  • BrainMonkey

    Mocking utility for PHP functions and WordPress plugin API

  • Check out brain monkey - it is my preferred mocking utility these days instead of WP_Mock.

  • PHPUnit-Polyfills

    Set of polyfills for changed PHPUnit functionality to allow for creating PHPUnit cross-version compatible tests

  • Check out the phpunit-polyfills package. This is pretty much a must if you want to test much older wordpress and php versions.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts