PHPUnit
$ phpunit Community Low Riskphpunit 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.
brew install phpunit Local PHP test runner tied to composer.json and phpunit.xml; invoke vendor/bin/phpunit or phpunit directly.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
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-junitand--list-tests-xmlrather than JSON - Clean
--colors=neverand--testdoxformatting
Local execution with no credentials; --do-not-cache-result avoids writing .phpunit.result.cache.
--do-not-cache-resultprevents cache file side effects
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
Industry-standard PHP test runner supporting JUnit, Clover, and TeamCity output formats.
- Supports
--log-junit,--coverage-clover, and--log-teamcity
Maintained by Sebastian Bergmann (sebastianbergmann/phpunit) for over two decades under BSD-3-Clause.
- Canonical PHP testing framework
Well-maintained official manual at docs.phpunit.de and thorough --help reference.
- Versioned CLI reference at docs.phpunit.de
Security, Auth & Guardrails
No credentials required; executes local PHP tests via the PHP CLI runtime.
BSD-3-Clause open-source PHP tool; free.
# 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
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.
phpunit --list-tests --colors=never
Prints all discovered test identifiers without running any test cases.
Controlled Writes & Previews
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-junitmake targeted CI and agent verification straightforward. - +
--colors=neverand--do-not-cache-resultkeep workspace output clean.
Caveats & Pitfalls
- ! No native
--jsonoutput flag; structured reporting relies on XML (--log-junit,--list-tests-xml). - ! Major PHPUnit versions strictly require matching PHP runtime versions.