Skip to content
Agentmart
Submit a tool

phpunit

PHPUnit knowledge for writing, running, debugging, and improving tests — writing tests, the CLI test runner, fixtures/setup-teardown, test organization…

Skill by MisterIcy

IndexedApache-2.0
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/mistericy-phpunit

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

PHPUnit knowledge for writing, running, debugging, and improving tests — writing tests, the CLI test runner, fixtures/setup-teardown, test organization, risky/incomplete/skipped tests, test doubles (mocks/stubs), code coverage analysis, assertions, attributes/annotations, XML configuration, error handling (errors/warnings/deprecations), CLI options, and the event system. Covers PHPUnit 9 through 13, version-gated (annotations vs. attributes, event system introduction, config schema changes, risky-test defaults, mocking API changes all differ by version). Use whenever the user is writing, running, or debugging PHPUnit tests, mentions "PHPUnit," `phpunit.xml`, `#[Test]`/`@test`, data providers, test doubles/mocks in a PHP context, or asks to improve/upgrade an existing PHPUnit test suite.

Use cases: backend, testing, data, writing

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found
Runs as
Shell scripts

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/phpunit

What's inside

Skill name
phpunit
Description
PHPUnit knowledge for writing, running, debugging, and improving tests — writing tests, the CLI test runner, fixtures/setup-teardown, test organization, risky/incomplete/skipped tests, test doubles (mocks/stubs), code coverage analysis, assertions, attributes/annotations, XML configuration, error handling (errors/warnings/deprecations), CLI options, and the event system. Covers PHPUnit 9 through 13, version-gated (annotations vs. attributes, event system introduction, config schema changes, risky-test defaults, mocking API changes all differ by version). Use whenever the user is writing, running, or debugging PHPUnit tests, mentions "PHPUnit," `phpunit.xml`, `#[Test]`/`@test`, data providers, test doubles/mocks in a PHP context, or asks to improve/upgrade an existing PHPUnit test suite.
License
Apache-2.0
Instructions
79 lines in SKILL.md · view on GitHub

Before installing

  • Ships executable scripts

Files (74)

  • SKILL.md
  • evals.json · evals/
  • annotations.md · references/phpunit-10/
  • assertions.md · references/phpunit-10/
  • cli-options.md · references/phpunit-10/
  • cli-runner.md · references/phpunit-10/
  • configuration-files.md · references/phpunit-10/
  • coverage-analysis.md · references/phpunit-10/
  • error-handling.md · references/phpunit-10/
  • events.md · references/phpunit-10/
  • fixtures.md · references/phpunit-10/
  • index.md · references/phpunit-10/
  • risky-incomplete-tests.md · references/phpunit-10/
  • test-doubles.md · references/phpunit-10/
  • test-organization.md · references/phpunit-10/
  • writing-tests.md · references/phpunit-10/
  • annotations.md · references/phpunit-11/
  • assertions.md · references/phpunit-11/
  • cli-options.md · references/phpunit-11/
  • cli-runner.md · references/phpunit-11/
  • configuration-files.md · references/phpunit-11/
  • coverage-analysis.md · references/phpunit-11/
  • error-handling.md · references/phpunit-11/
  • events.md · references/phpunit-11/
  • fixtures.md · references/phpunit-11/
  • index.md · references/phpunit-11/
  • risky-incomplete-tests.md · references/phpunit-11/
  • test-doubles.md · references/phpunit-11/
  • test-organization.md · references/phpunit-11/
  • writing-tests.md · references/phpunit-11/
  • annotations.md · references/phpunit-12/
  • assertions.md · references/phpunit-12/
  • cli-options.md · references/phpunit-12/
  • cli-runner.md · references/phpunit-12/
  • configuration-files.md · references/phpunit-12/
  • coverage-analysis.md · references/phpunit-12/
  • error-handling.md · references/phpunit-12/
  • events.md · references/phpunit-12/
  • fixtures.md · references/phpunit-12/
  • index.md · references/phpunit-12/
  • risky-incomplete-tests.md · references/phpunit-12/
  • test-doubles.md · references/phpunit-12/
  • test-organization.md · references/phpunit-12/
  • writing-tests.md · references/phpunit-12/
  • annotations.md · references/phpunit-13/
  • assertions.md · references/phpunit-13/
  • cli-options.md · references/phpunit-13/
  • cli-runner.md · references/phpunit-13/
  • configuration-files.md · references/phpunit-13/
  • coverage-analysis.md · references/phpunit-13/
  • error-handling.md · references/phpunit-13/
  • events.md · references/phpunit-13/
  • fixtures.md · references/phpunit-13/
  • index.md · references/phpunit-13/
  • risky-incomplete-tests.md · references/phpunit-13/
  • test-doubles.md · references/phpunit-13/
  • test-organization.md · references/phpunit-13/
  • writing-tests.md · references/phpunit-13/
  • annotations.md · references/phpunit-9/
  • assertions.md · references/phpunit-9/
  • …and 14 more

SKILL.md (first lines)

# PHPUnit

Reference knowledge for anyone writing, running, debugging, or improving
PHPUnit tests in a PHP codebase — not a general PHP testing tutorial, and not
for other PHP test frameworks (Pest, Codeception, Behat) even though some
share underlying concepts.

## Workflow

1. **Determine the PHPUnit major version in use.** Run:
   ```
   scripts/detect-phpunit-version.sh <path-to-project-root>
   ```
   It checks, in order: `composer.lock`'s resolved `phpunit/phpunit` version,
   then `composer.json`'s `phpunit/phpunit` constraint (require-dev or
   require), then `vendor/bin/phpunit --version` as a last resort. It prints
   a bare major version (`9`–`13`) on success. If it fails (no composer
   files, no vendor install, genuinely ambiguous constraint like `^9 || ^10`),
   ask the user which version to target, or default to the newest supported
   major (13) and say explicitly that you're assuming it.

   If the detected major isn't one of 9–13 (e.g. an EOL version like 8, or a
   version newer than what this skill has covered), use the nearest
   supported major's reference as a best-effort approximation and flag that
   explicitly — don't silently treat it as an exact match.

2. **Load that version's reference directory**: `references/phpunit-<major>/index.md`
   is the table of contents for that version — it lists all 13 topic files
   with a one-line description and the version's canonical docs root URL.
   Load the specific topic file(s) relevant to the task at hand from there;
   don't load all 13 for a single narrow question.

   Available topics per version: writing tests, CLI runner, fixtures, test
   organization, risky/incomplete tests, test doubles, coverage analysis,
   assertions, annotations (metadata mechanism), configuration files, error
   handling, CLI options, events.

3. **If the task spans two versions** (an upgrade, a compatibility question,
   "does this work on both 10 and 12?"), also read
   `references/version-differences.md` — it summarizes the major breaking
   changes across 9→13 (the annotations→attributes migration, the event
   system's introduction and evolution, config schema changes, mocking-API
   deprecations, risky-test default shifts) with pointers to which version
   directories have the full detail.

4. **Prefer this skill's condensed knowledge first**, but every topic file
   ends with a `Source` line linking to the exact docs.phpunit.de page(s) it
   was drawn from — fetch that page directly if you need more detail than
   the summary carries, or if the user reports behavior that contradicts
   what's written here (the summaries were accurate as of when this skill
   was built; PHPUnit's docs do change).

5. **Write/run/debug the actual tests** using the loaded version's
   conventions — e.g. don't write `@dataProvider` doc-comments for a
   PHPUnit 12/13 target (annotations are fully removed there; use
   `#[DataProvider]`), and don't assume a PHPUnit 9 target has an event
   system to hook into.

## Common mistakes to avoid

- Assuming annotation/attribute support is uniform across versions — it
  isn't (see `references/version-differences.md`); always confirm against
  the detected version's own `annotations.md`.
- Skipping version detection and defaulting straight to "current" PHPUnit
  conventions — a repo pinned to 9 or 10 will reject 12/13-only syntax.
  `composer.lock`, when present, reflects what's actually installed, not
  just what's requested — prefer it over `composer.json`'s constraint.
  Verify by opening `composer.lock` (or running `composer show
  phpunit/phpunit` if a shell is available) whenever the two might disagree,
  e.g. a loose constraint like `^9 || ^10`.
- Treating a risky-test failure, a config directive, or a mocking API call
  as portable across versions without checking that specific version's
  reference file — defaults and available options shift release to release.
- Loading every topic file for every question — load the version's
  `index.md` first, then only the topic file(s) the task actually needs.
- Confusing this skill with a general PHP testing tutorial — it assumes the
  reader already knows PHP and just needs PHPUnit-specific mechanics.

From MisterIcy/provenance, Apache-2.0.

More from MisterIcy/provenance

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Sep 8, 2026 (1 month ago)
Last release
Sep 9, 2026 (1 month ago)

From GitHub (fetched Oct 24, 2026).

Details

License
Apache-2.0
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from MisterIcy

Cite this page

phpunit skill. Agent Mart. https://agentmart.dev/skills/mistericy-phpunit (last updated 2026-10-24)