PHPackages                             aldavigdis/wp-tests-strapon - 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. aldavigdis/wp-tests-strapon

ActiveLibrary[Testing &amp; Quality](/categories/testing)

aldavigdis/wp-tests-strapon
===========================

Strap the WordPress PHPUnit tests library onto your plugin or theme with this handy Composer package.

0.1.7(1y ago)812.5k↓50%1[2 issues](https://github.com/aldavigdis/wp-tests-strapon/issues)AGPL-3.0-or-laterPHPCI passing

Since Mar 20Pushed 1y ago2 watchersCompare

[ Source](https://github.com/aldavigdis/wp-tests-strapon)[ Packagist](https://packagist.org/packages/aldavigdis/wp-tests-strapon)[ Docs](https://github.com/aldavigdis/wp-tests-strapon)[ GitHub Sponsors](https://github.com/aldavigdis)[ RSS](/packages/aldavigdis-wp-tests-strapon/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (11)Versions (14)Used By (0)

WP-Tests-Strapon
================

[](#wp-tests-strapon)

Strap the WordPress PHPUnit tests library onto your WordPress plugin or theme with this handy Composer package.

This PHP Composer package facilitates the configuration and installation of a WordPress test environment so that WordPress' functionality can be used in your PHPUnit test suite.

In essence, it has the same purpose as the `install-wp-tests.sh` shell script installed by the WP-CLI scaffolder, but takes a more streamlined approach:

- It comes as a PHP Composer package, simplifying updates and maintainance, with no extra files in your own codebase
- Is 100% programmed in PHP, so it does not require skills beyond that to contribute to the project
- Has the same dependencies as one can expect from any WordPress development environment (the `cURL` and `ZipArchive` PHP modules)
- Does not depend on ancient technology that nobody should use anymore, such as Subversion
- The test environments are downloaded and configured automatically using information from your PHPUnit configuration file and environment variables
- No need to re-run a script to install a development environment with the same parameters after every time you restart your computer or development environment

[![A screenshot of WP-Tests-Strapon, showing the test suite being prepared and run.](https://raw.githubusercontent.com/aldavigdis/wp-tests-strapon/main/docs/images/screenshot1.png)](https://raw.githubusercontent.com/aldavigdis/wp-tests-strapon/main/docs/images/screenshot1.png)

Usage
-----

[](#usage)

WP-Tests-Strapon integrates with PHPUnit and acts as a bootstrap layer between it and your WordPress plugin's test suite. Simply run `./vendor/bin/phpunit` as you would generally do after following the installation instructions below.

For more information on PHPUnit itself and how to write tests, [you should read their documentation](https://phpunit.de/getting-started/phpunit-10.html).

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

[](#installation)

1. Make sure you have version 9 or 10 of PHPUnit installed as a development dependency for your project.
2. Install the Composer package using `composer require --dev aldavigdis/wp-tests-strapon`.

Finally, Open up your PHPUnit configuration file (`phpunit.xml` or `phpunit.xml.dist`) and set the `bootstrap` attribute of the root `` element to `vendor/aldavigdis/wp-tests-strapon/bootstrap.php`.

Alternatively, you can include or require `vendor/aldavigdis/wp-tests-strapon/bootstrap.php` in your own PHPUnit bootstrap file.

### Example PHPUnit configuration file

[](#example-phpunit-configuration-file)

```

      tests

```

Environment variables and constants
-----------------------------------

[](#environment-variables-and-constants)

You can set those in your `phpunit.xml` file, in your terminal session or in your test and production environments.

### PHPUnit Bootstrap

[](#phpunit-bootstrap)

- `WP_TESTS_CONFIG_FILE_PATH` (constant): The location of your test environment's config file. Defaults to `/tmp/wp-tests-strapon/config.php` on Linux/Unix/macOS.
- `WP_VERSION` (environment variable): The PHP version to test against. Defaults to `master`.

### Config File Constants

[](#config-file-constants)

The following constants will be set in your WordPress test configuration file:

- `WP_DEFAULT_THEME`
- `WP_TESTS_MULTISITE`
- `WP_DEBUG`
- `TABLE_PREFIX`
- `DB_NAME`
- `DB_USER`
- `DB_PASSWORD`
- `DB_HOST`
- `WP_TESTS_DOMAIN`
- `WP_TESTS_EMAIL`
- `WP_TESTS_TITLE`
- `WP_PHP_BINARY`
- `WPLANG`

The default values can be overridden when the file is generated by setting environment variables of the same name. You can do it using your PHPUnit configuration file, the PHPUnit runtime parameters, globally in your terminal or in your CI environment.

The Todo List
-------------

[](#the-todo-list)

- Test the database connection when the config file is initialised
- Create the database if it does not exsist
- Improve documentation
- Add more tests
- Add more glitter
- Test on a Mac
- Get Windows support sorted out (both CMD and PowerShell)

FAQ
---

[](#faq)

**Q:** Why did you choose the AGPL license as opposed to a less restrictive one?

**A:** The AGPL makes sure that those who are using my software without paying contribute back if they modify it. If you would like a different licensing agreement for a fee, then that can be arranged.

**Q:** What's with the emoji everywhere?

**A:** What's with you being so boring and dull?

License
-------

[](#license)

Copyright (c) 2024 Alda Vigdís Skarphéðinsdóttir

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see .

**For questions regarding the license or requests for alternative license arrangements, please contact the author at **.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 97.4% 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 ~52 days

Recently: every ~77 days

Total

7

Last Release

478d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4ccdaeb5f30a50947d0a51a9d347be281d1885d1cdd10e8180640b7dff557749?d=identicon)[aldavigdis](/maintainers/aldavigdis)

---

Top Contributors

[![aldavigdis](https://avatars.githubusercontent.com/u/191583?v=4)](https://github.com/aldavigdis "aldavigdis (37 commits)")[![Ipstenu](https://avatars.githubusercontent.com/u/807903?v=4)](https://github.com/Ipstenu "Ipstenu (1 commits)")

---

Tags

php8phpunitwordpresswordpress-developmenttestingphpunitdevwordpress

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/aldavigdis-wp-tests-strapon/health.svg)

```
[![Health](https://phpackages.com/badges/aldavigdis-wp-tests-strapon/health.svg)](https://phpackages.com/packages/aldavigdis-wp-tests-strapon)
```

###  Alternatives

[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)[yoast/wp-test-utils

PHPUnit cross-version compatibility layer for testing plugins and themes build for WordPress

632.3M52](/packages/yoast-wp-test-utils)[donatj/mock-webserver

Simple mock web server for unit testing

1382.5M80](/packages/donatj-mock-webserver)[robiningelbrecht/phpunit-pretty-print

Prettify PHPUnit output

76460.0k15](/packages/robiningelbrecht-phpunit-pretty-print)[juampi92/test-seo

Easy way to test your SEO

26341.0k](/packages/juampi92-test-seo)

PHPackages © 2026

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