wp-phpunit-test-setup

wp-phpunit-test-setup is a skill for Claude Code, Codex from Lonsdale201/wp-agent-skills. It costs 215 tokens per session (3,087 once invoked), scanned A, original, MIT.

A setup guide for running PHPUnit integration tests against a real WordPress plugin or theme. PHPUnit is a tool that automatically runs code tests, and integration tests check how code works with WordPress itself.

In plain words
What is it for?
Use it when adding tests to an untested plugin or theme, connecting tests to CI systems, or fixing test-database, bootstrap, installation, and PHPUnit-version problems.
Why use it?
It provides the test files, configuration, WordPress test installation, and continuous-integration setup needed before writing tests.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is bash bin/install-wp-tests.sh <db-name> <db-user> <db-pass> [db-host] [wp-version] [skip-database-creation].

Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/Lonsdale201/wp-agent-skills
agentmods
npx agentmods add skills/lonsdale201/wp-agent-skills/wp-phpunit-test-setup

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for wp-phpunit-test-setup

README.md
[![agentmods](https://agentmods.dev/badge/skills/lonsdale201/wp-agent-skills/wp-phpunit-test-setup.svg)](https://agentmods.dev/skills/lonsdale201/wp-agent-skills/wp-phpunit-test-setup)
Your own site
<a href="https://agentmods.dev/skills/lonsdale201/wp-agent-skills/wp-phpunit-test-setup"><img src="https://agentmods.dev/badge/skills/lonsdale201/wp-agent-skills/wp-phpunit-test-setup.svg" alt="Measured on agentmods" height="20"></a>
Per session 215 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,087 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00215 $0.03087
Opus 5 $0.00108 $0.01543
Sonnet 5 $0.00043 $0.00617
Haiku 4.5 $0.00021 $0.00309

Measured 6d ago against content hash 52394c6dec8d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

wp-phpunit-test-setup scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

core also uses SVN. The generated installer therefore needs `curl` or `wget`,
dev-tooling/wp-phpunit-test-setup/SKILL.md · 220 lines

How it starts

The opening of the file, as written. The whole thing — 220 lines — stays where its author put it; the contents beside it link to each section on GitHub.

WordPress PHPUnit test setup

Get a real WordPress integration test harness running for a plugin or theme. The fast path is WP-CLI's scaffolder, which generates the same layout WordPress core uses. This skill is the setup + CI half; writing the actual tests is wp-phpunit-writing-tests.

When to use this skill

  • Adding automated tests to a plugin/theme that has none.
  • Wiring PHPUnit into CI (GitHub Actions, GitLab, etc.).
  • Debugging install-wp-tests.sh, the test database, tests/bootstrap.php, or "wrong PHPUnit version" errors.
  • Reviewing a repo's phpunit.xml.dist, composer.json test scripts, or CI matrix.

The PHPUnit version reality (read this first)

The most common setup mistake: requiring PHPUnit 10 or 11 for a WP_UnitTestCase integration suite. WordPress 7.1's core test library remains on PHPUnit 9.x: the official matrix assigns PHPUnit 9 to WordPress 7.1 on PHP 7.4 through 8.5, and core's phpunit.xml.dist uses the PHPUnit 9.2 schema. Check the official compatibility table for each WordPress/PHP branch instead of extrapolating from the newest PHP.

WP_UnitTestCase-based tests boot the real WordPress test suite, so they run on the PHPUnit version the suite supports — PHPUnit 9.x for current WordPress. The bridge across PHPUnit majors is yoast/phpunit-polyfills, a hard dependency of the WP test suite since WordPress 5.9.

Practical rule: pin PHPUnit to ^9 and yoast/phpunit-polyfills to the constraint your installed WordPress expects (the scaffolded CI uses phpunit-polyfills:1.1; WordPress core pins the 1.x line). The polyfills package has newer majors (4.x), but match what the WP test suite bootstrap loads — do not assume the newest works. Verify against your WP version, do not guess.

Scaffold the harness

wp scaffold plugin-tests my-plugin --ci=github
# or for a theme:
wp scaffold theme-tests my-theme --ci=github

Read the full file on GitHub · 220 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 220 lines · 215 tokens per session scan A 52394c6dec8d

Subscribe to this mod's changes

wp-phpunit-test-setup is a skill published in the GitHub repository Lonsdale201/wp-agent-skills (22 stars, last pushed 7d ago), licensed MIT. It adds 215 tokens to every session and 3,087 once invoked, about $0.0011 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

test-driven-development

Drives development with tests. Use when implementing any logic, fixing any bug, or changing any behavior. Use when you need to prove that code works, when a bug report arrives, or when you're about to modify existing functionality.

addyosmani/agent-skills · 50 tokens

skillshare-implement-feature

Implement a feature from a spec file or description using TDD workflow. Use this skill whenever the user asks to: add a new CLI command, implement a feature from a spec, build new functionality, add a flag, create a new internal package, or write Go code for skillshare. This skill enforces test-first development…

runkids/skillshare · 114 tokens

create-custom-grader

Use when converting an existing benchmark, rubric, verifier, task YAML/JSON, or domain check into SkillEvaluator BYOG/BYOT custom evaluation.

NVIDIA/SkillEvaluator · 35 tokens

story-origin-check

Recover the first public timestamp and canonical major coverage for a newsjacking signal, then decide whether newer coverage is the same story, a different story, or a materially new development.

elvisun/newsjack · 40 tokens

prompt-proximity-architecture

Turn an approved measurement charter, ICPs, and buyer jobs into a budget-aware prompt coverage blueprint across proximity bands, aided status, information acts, journey states, roles, locales, evidence grades, partitions, and measurement lanes. Use before prompt wording to define required, optional, and prohibited…

elvisun/newsjack · 67 tokens

xdto-validate

Валидация пакета XDTO 1С. Используй после создания или модификации пакета XDTO для проверки корректности.

Nikolay-Shirokov/cc-1c-skills · 34 tokens