Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

PHPUnit

$ phpunit Community Low Risk
Sebastian Bergmann · Code & DevOps · BSD-3-Clause · macos / linux / windows

phpunit is the de facto testing framework CLI for PHP applications and Composer packages. It offers headless execution, --filter regex selection, --list-tests-xml test enumeration, and --log-junit / --coverage-clover XML exports, though it lacks native JSON test reporting.

FCRS-1.0 Score
78 /100
Good
Medium Confidence
Zero-Friction Install
brew install phpunit
CLI vs MCP Decision CLI Only

Local PHP test runner tied to composer.json and phpunit.xml; invoke vendor/bin/phpunit or phpunit directly.

Agent-Readiness Checklist

— JSON Output
✓ Field Filtering
✓ Non-Interactive
— Dry-Run
— Read-Only Mode
✓ NO_COLOR Clean
✓ Self-Describing
— Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 19 / 25

Non-interactive by default with --filter, --colors=never, --list-tests-xml, and --log-junit, though it lacks a native --json report flag.

  • Outputs XML via --log-junit and --list-tests-xml rather than JSON
  • Clean --colors=never and --testdox formatting
Trust & Safety 20 / 25

Local execution with no credentials; --do-not-cache-result avoids writing .phpunit.result.cache.

  • --do-not-cache-result prevents cache file side effects
Setup & Portability 12 / 15

Distributed via PHAR, Homebrew, and Composer across macOS, Linux, and Windows; requires matching PHP version and extensions.

  • Available via brew install phpunit, PHAR, and Composer
Utility & Efficiency 12 / 15

Industry-standard PHP test runner supporting JUnit, Clover, and TeamCity output formats.

  • Supports --log-junit, --coverage-clover, and --log-teamcity
Maintenance & Lineage 8 / 10

Maintained by Sebastian Bergmann (sebastianbergmann/phpunit) for over two decades under BSD-3-Clause.

  • Canonical PHP testing framework
Docs & Verifiability 7 / 10

Well-maintained official manual at docs.phpunit.de and thorough --help reference.

  • Versioned CLI reference at docs.phpunit.de

Security, Auth & Guardrails

Auth Modes
No Auth
Credential Storage

No credentials required; executes local PHP tests via the PHP CLI runtime.

Side Effects
Read-Only Local Write
Cost & Quotas

BSD-3-Clause open-source PHP tool; free.

Copyable Guardrail for CLAUDE.md / AGENTS.md
# PHPUnit Agent Rules
- Always pass `--colors=never` and scope large suites with `--filter` or a specific test file path.
- Prefer project-local `vendor/bin/phpunit` over global `phpunit` when `composer.lock` is present.
- Use `--log-junit <file>` when structured failure details are needed.

Agent-Ready Command Recipes

Safe Read-Only Queries

Run filtered PHP tests without colors
phpunit --filter UserServiceTest --colors=never --do-not-cache-result

Executes matching PHPUnit test classes or methods with clean monochrome output and no result cache file.

List available tests to stdout
phpunit --list-tests --colors=never

Prints all discovered test identifiers without running any test cases.

Controlled Writes & Previews

Run suite and export JUnit XML report
phpunit --log-junit build/junit.xml --colors=never

Executes the test suite and writes structured JUnit XML results to build/junit.xml.

Strengths for Agents

  • + --filter, --list-tests, and --log-junit make targeted CI and agent verification straightforward.
  • + --colors=never and --do-not-cache-result keep workspace output clean.

Caveats & Pitfalls

  • ! No native --json output flag; structured reporting relies on XML (--log-junit, --list-tests-xml).
  • ! Major PHPUnit versions strictly require matching PHP runtime versions.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI