Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add Lonsdale201/wp-agent-skills --skill wp-phpunit-writing-testsgit clone --depth 1 https://github.com/Lonsdale201/wp-agent-skillsWrote 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.
[](https://agentmods.dev/skills/lonsdale201/wp-agent-skills/wp-phpunit-writing-tests)<a href="https://agentmods.dev/skills/lonsdale201/wp-agent-skills/wp-phpunit-writing-tests"><img src="https://agentmods.dev/badge/skills/lonsdale201/wp-agent-skills/wp-phpunit-writing-tests/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/lonsdale201/wp-agent-skills/wp-phpunit-writing-tests"><img src="https://agentmods.dev/badge/skills/lonsdale201/wp-agent-skills/wp-phpunit-writing-tests.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector pass
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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00205 | $0.02777 |
| Opus 5 | $0.00102 | $0.01388 |
| Sonnet 5 | $0.00041 | $0.00555 |
| Haiku 4.5 | $0.00020 | $0.00278 |
Grade A, and why
wp-phpunit-writing-tests scanned grade A with 0 findings 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 10d 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.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
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.
Writing WordPress PHPUnit tests
Once the harness is in place (wp-phpunit-test-setup), this skill is about the tests themselves: which base class, how to build fixtures, how to mock, and the integration-vs-unit decision that trips most people up.
When to use this skill
- Writing the first real tests for a plugin/theme.
- Reviewing tests for correct fixtures, isolation, and mocking.
- Deciding between an integration test and a true unit test.
- Mocking outbound HTTP (
wp_remote_*) or WP functions.
Integration vs unit — get this right first
WP_UnitTestCase boots the full WordPress environment and uses a real test
database. Its teardown and factory cleanup isolate normal WordPress records,
but do not describe the suite as a universal per-test transaction: code that
commits, creates tables/files, changes external services, starts cron workers,
or mutates non-database globals still needs explicit cleanup. Despite the name,
this is an integration test, not a pure unit test.
For true unit tests — fast, isolated, no WP boot, no DB — you mock WordPress functions with one of:
- Brain Monkey (
brain/monkey, 2.7.x) — Mockery + Patchwork based; expressivewhen()/expect(). - WP_Mock (
10up/wp_mock, 1.1.x) — explicit per-function expectations, action/filter helpers.
Rule of thumb: test your own logic (a calculator, a formatter, a class method) as a unit test with mocked WP calls; test interaction with WordPress (it really saved the post, the hook really ran) as a WP_UnitTestCase integration test. Most plugins want both, in separate test suites.
Integration tests: WP_UnitTestCase
Fixtures are snake_case — and that matters
class Test_My_Plugin extends WP_UnitTestCase {
public function set_up(): void {
parent::set_up(); // MUST be the first line
// per-test arrange
}
public function tear_down(): void {
// per-test cleanup
parent::tear_down(); // MUST be the last line
}
public function test_it_does_a_thing(): void {
$this->assertTrue( my_plugin_does_a_thing() );
}
}
What ships with it
1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
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.
- 10d ago First seen · 220 lines · 205 tokens per session scan A 694ba9e5b51b
wp-phpunit-writing-tests is a skill published in the GitHub repository Lonsdale201/wp-agent-skills (22 stars, last pushed 11d ago), licensed MIT. It adds 205 tokens to every session and 2,777 once invoked, about $0.0010 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
phpunit-testing
Guide for writing and running PHPUnit unit and integration tests for WP Rig theme components.
laravel-testing
Test strategy for a layered Laravel application — which test style fits each layer, hand-written fakes over mocks, real-database tests for Query Classes and Repositories, pure tests for Value Objects, and feature tests that assert authorization, payload shape and query counts. Use when writing or reviewing Laravel…
laravel-tdd
Drives Laravel feature development with Pest or PHPUnit — factories, RefreshDatabase, fakes for queues/mail/notifications, Sanctum auth, and Inertia assertions. Use when writing or fixing a Laravel controller, Eloquent model, policy, job, or notification, when the project uses Pest/PHPUnit, or when asked to test an…
pw-test
Use when creating, executing, or managing Pest tests within ProcessWire or ProcessWire modules, including Test-Driven Development (TDD) tasks.
migrate-mstest-v3-to-v4
Use this skill before answering, planning, or editing any MSTest 3.x-to-4.x upgrade or post-upgrade failure. Triggers include "MSTest v4 breaking changes"; CS0507/CS0103/CS1061/CS1615; ExecuteAsync, CallerInfo, DisplayName, or custom TestMethodAttribute; ClassCleanupBehavior; ContainsKey; ThrowsExactly or…
migrate-xunit-to-mstest
Convert .NET tests from xUnit.net v2/v3 to MSTest v4 while preserving VSTest or MTP. Use for replacing xunit packages, Fact/Theory/InlineData/MemberData, assertions, IClassFixture/ICollectionFixture, ITestOutputHelper, TestContext cancellation, traits/Owner, skips, timeouts, and xUnit parallelization. Also use when a…