PHPackages                             pantheon-systems/wpunit-helpers - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. pantheon-systems/wpunit-helpers

ActiveComposer-plugin[Testing &amp; Quality](/categories/testing)

pantheon-systems/wpunit-helpers
===============================

Unified scripts for installing and running automated WP Unit Tests.

v2.0.3(9mo ago)433.6k↑33.3%1[2 issues](https://github.com/pantheon-systems/wpunit-helpers/issues)[1 PRs](https://github.com/pantheon-systems/wpunit-helpers/pulls)10MITShellCI passing

Since Oct 12Pushed 1mo ago22 watchersCompare

[ Source](https://github.com/pantheon-systems/wpunit-helpers)[ Packagist](https://packagist.org/packages/pantheon-systems/wpunit-helpers)[ RSS](/packages/pantheon-systems-wpunit-helpers/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (8)Dependencies (2)Versions (12)Used By (10)

WPUnit Helpers
==============

[](#wpunit-helpers)

[![Lint](https://github.com/pantheon-systems/wpunit-helpers/actions/workflows/lint.yml/badge.svg)](https://github.com/pantheon-systems/wpunit-helpers/actions/workflows/lint.yml) [![Test](https://github.com/pantheon-systems/wpunit-helpers/actions/workflows/test.yml/badge.svg)](https://github.com/pantheon-systems/wpunit-helpers/actions/workflows/test.yml) [![GitHub](https://camo.githubusercontent.com/35b7a88bebb93ec2298795f5625d7805c65b8c8b56c14f0ea0dfef969b80c91c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f70616e7468656f6e2d73797374656d732f7770756e69742d68656c70657273)](https://camo.githubusercontent.com/35b7a88bebb93ec2298795f5625d7805c65b8c8b56c14f0ea0dfef969b80c91c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f70616e7468656f6e2d73797374656d732f7770756e69742d68656c70657273) [![GitHub release (latest by date)](https://camo.githubusercontent.com/e96f14626f7376f56788c44387159d83d29d7406e6dd3bb002a952674cab2235/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f70616e7468656f6e2d73797374656d732f7770756e69742d68656c70657273)](https://camo.githubusercontent.com/e96f14626f7376f56788c44387159d83d29d7406e6dd3bb002a952674cab2235/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f70616e7468656f6e2d73797374656d732f7770756e69742d68656c70657273) [![Unofficial Support](https://camo.githubusercontent.com/c4d3e0e10f8a93bccd45cb1763a1405ec4c4ad277b4638b41a887ebf499e4c02/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f50616e7468656f6e2d556e6f6666696369616c253230537570706f72742d79656c6c6f773f6c6f676f3d70616e7468656f6e26636f6c6f723d464644433238)](https://docs.pantheon.io/oss-support-levels#unofficial-support)

Composer plugin providing unified scripts for installing and running automated WP Unit Tests.

What is this?
-------------

[](#what-is-this)

This is a set of scripts that can be used in a WordPress plugin or theme repository to run automated tests using the WP Unit Test Framework built on top of PHPUnit. The Composer plugin will install these scripts into the dependent project's `bin` directory, allowing you to add helper scripts to your `composer.json`.

This package fundamentally differs from the traditional `install-wp-tests.sh` script that's existed in the WordPress community for many years by removing some of the idiosyncracies of that workflow and replacing them with a WP-CLI-based approach.

Requirements
------------

[](#requirements)

Before using these scripts, you must have the following installed:

- [Composer](https://getcomposer.org/)
- [WP-CLI](https://wp-cli.org/)

Additionally, if you intend to run the tests in a CI environment, you will need to have some modern MySQL-compatible database server available (MariaDB, MySQL, etc).

What's included?
----------------

[](#whats-included)

- `install-wp-tests.sh` - A standardized script for installing the WP Unit Test Framework.
- `install-local-tests.sh` - A helper script for installing WP Unit Tests locally. See [Local Testing](#local-testing) for more information.
- `phpunit-test.sh` - A helper script for running WP Unit Tests that is intended for use in CI.
- `helpers.sh` - A collection of helper functions used by the other scripts.

Installation
------------

[](#installation)

Use Composer to install this package as a development dependency:

```
composer require --dev pantheon-systems/wpunit-helpers
```

On installation, the Composer plugin will copy the scripts into the `bin` directory of the dependent project. You can then add the scripts to your `composer.json`:

```
{
	"scripts": {
		"phpunit": "phpunit --do-not-cache-result",
		"test": "@phpunit",
		"test:install": "bin/install-local-tests.sh --skip-db=true",
		"test:install:withdb": "bin/install-local-tests.sh"
	}
}
```

Nightly WordPress tests
-----------------------

[](#nightly-wordpress-tests)

By default, the `phpunit-test.sh` script will run tests against both the latest stable version of WordPress and the latest nightly build. This is useful for ensuring that your plugin or theme is compatible with the latest changes in WordPress core.

If you would like to exclude the nightly tests, you can pass the `--skip-nightly` flag to the `phpunit-test.sh` script. This will only run tests against the latest stable version of WordPress.

```
{
	"scripts": {
		"phpunit": "bin/phpunit-test.sh --skip-nightly",
		"test": "@phpunit",
	}
}
```

Local Testing
-------------

[](#local-testing)

The `install-local-tests.sh` script is highly configurable to allow for a variety of local environment setups. Any parameter that could be passed into `install-wp-tests.sh` is set up as an optional flag in `install-local-tests.sh`. By default, the script with no flags will assume that a new database should be created as `root` with no password.

### Flags

[](#flags)

#### `--skip-db`

[](#--skip-db)

If set and `true`, this flag will skip the database creation step. This is useful if you are using a local database that is already set up. This replaces the (now deprecated) `--no-db` flag. This flag can also be passed to the `phpunit-test.sh` script to skip the database creation step when running tests.

#### `--dbname`

[](#--dbname)

This flag will set the name of the database to be created. The default value is `wordpress_test`.

#### `--dbuser`

[](#--dbuser)

This flag will set the username of the database user to be created. The default value is `root`.

#### `--dbpass`

[](#--dbpass)

This flag will set the password of the database user to be created. The default value is an empty string.

#### `--dbhost`

[](#--dbhost)

This flag will set the host of the database to be created. The default value is `127.0.0.1`.

#### `--wpversion`

[](#--wpversion)

This flag will set the version of WordPress to be installed. The default value is `latest`. Using `nightly` here will use the latest nightly build of WordPress.

#### `--tmpdir`

[](#--tmpdir)

This flag will set the temporary directory to be used for the WordPress installation. The default value is `/tmp`.

### `--skip-nightly`

[](#--skip-nightly)

This flag will skip the installation of the latest nightly build of WordPress. This is useful if you only want to run tests against the latest stable version of WordPress.

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance66

Regular maintenance activity

Popularity33

Limited adoption so far

Community26

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 70% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~95 days

Recently: every ~135 days

Total

8

Last Release

284d ago

Major Versions

v1.x-dev → v2.0.02024-02-13

### Community

Maintainers

![](https://www.gravatar.com/avatar/5a89f5f15357797cbd6ec7833a28626478ae3c0ceb5fa1faa8a26d0960584c65?d=identicon)[pantheon-systems](/maintainers/pantheon-systems)

![](https://www.gravatar.com/avatar/af6c0ce1d250a8a8edc57b4759dabc3d5f7956fc105450bba7fc5d2eb5b74362?d=identicon)[jazzsequence](/maintainers/jazzsequence)

---

Top Contributors

[![jazzsequence](https://avatars.githubusercontent.com/u/991511?v=4)](https://github.com/jazzsequence "jazzsequence (7 commits)")[![TohaUA](https://avatars.githubusercontent.com/u/4780023?v=4)](https://github.com/TohaUA "TohaUA (2 commits)")[![greg-1-anderson](https://avatars.githubusercontent.com/u/612191?v=4)](https://github.com/greg-1-anderson "greg-1-anderson (1 commits)")

---

Tags

hacktoberfestphpunitunit-testingwordpresswp-unit

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/pantheon-systems-wpunit-helpers/health.svg)

```
[![Health](https://phpackages.com/badges/pantheon-systems-wpunit-helpers/health.svg)](https://phpackages.com/packages/pantheon-systems-wpunit-helpers)
```

###  Alternatives

[phpro/grumphp

A composer plugin that enables source code quality checks.

4.3k15.5M904](/packages/phpro-grumphp)[dealerdirect/phpcodesniffer-composer-installer

PHP\_CodeSniffer Standards Composer Installer Plugin

598161.9M1.9k](/packages/dealerdirect-phpcodesniffer-composer-installer)[codeception/c3

CodeCoverage collector for Codeception

745.3M51](/packages/codeception-c3)[digitalrevolution/php-codesniffer-baseline

Digital Revolution PHP\_Codesniffer baseline extension

18923.6k4](/packages/digitalrevolution-php-codesniffer-baseline)[axelerant/drupal-quality-checker

Code quality checking tools for Drupal project.

13197.9k1](/packages/axelerant-drupal-quality-checker)[youwe/testing-suite

Contains Youwe's default testing packages for php.

13176.9k8](/packages/youwe-testing-suite)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
