Skip to content

2023 · Creator & Maintainer

PHPUnit WordPress Tests

Composer package providing PHPUnit test utilities and bootstrap helpers for WordPress plugin and theme test suites — replaces the WordPress test-suite bootstrap boilerplate.

Role

Creator & Maintainer

Overview

Setting up a proper PHPUnit test suite for a WordPress plugin involves a lot of boilerplate: bootstrap files, database setup, factory helpers, and WP_Mock configuration. This package extracts that boilerplate into a reusable Composer dependency.

What It Provides

  • Drop-in bootstrap that loads WordPress test environment
  • Pre-configured WP factories (posts, users, terms, meta)
  • Custom assertion helpers: assertPostExists(), assertOptionEquals(), assertHookFired()
  • Test case base class with before/after cleanup
  • Compatible with WordPress 6.x and PHP 8.x

Usage

composer require --dev mralaminahamed/phpunit-wordpress-tests

Configure in phpunit.xml:

<phpunit bootstrap="vendor/mralaminahamed/phpunit-wordpress-tests/bootstrap.php">

Adoption

Over 900 Composer installs across WordPress plugin repositories.

Tech

PHP, PHPUnit, WordPress test environment, WP_Mock.

One email a month. No noise.

What I shipped, what I read, occasional deep dive. Unsubscribe anytime.

Interested in working together?

I'm open to freelance engagements and consulting. Let's talk.