# Test

> Write PHPUnit tests for PHP source files, auto-detecting conventions from the project.

- Skill: `wp-media/test` (Agent Skill)
- Install (CLI): `npx skillmds@latest add wp-media/test`
- Raw SKILL.md: https://api.skillmd.com/api/skills/wp-media/test/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: wp-media (https://skillmd.com/u/wp-media)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/wp-media/test

---


# Test Writer

Writes PHPUnit unit and integration tests for PHP source files in this project.

Conventions (naming, `@group` annotations, mocking libraries) are discovered from the architecture
skill and existing test files — not assumed. Works for any WordPress plugin with Cadenza.

## Project identity

Project identity is auto-detected (see AGENTS.md §3) — no config file.
This skill uses: `{ARCH_SKILL}`, `{DISPLAY_NAME}`.

## Steps

1. **Parse the argument** (if any):
   - No argument → `target = "auto"` (find changed source files on the current branch that lack test coverage)
   - `src/Foo/Bar.php` → `target = "src/Foo/Bar.php"`
   - Multiple files → `target = ["src/Foo/Bar.php", "src/Baz/Qux.php"]`

2. **Spawn `test-writer`** as a sub-agent, passing `target` and the project config above.

3. **Return** the list of test files written and the command to run them.

