PHPUNIT(1)
π
PHPUNIT β the phpunit(1) glow-up
okay bestie, welcome to the phpunit command line interface manual, aka the group chat where your PHP tests come to be seen and judged (lovingly) π. This is a User Commands page for PHPUNIT(1), and we're gonna read it together, no skipping. grab a strawberry drink π and let's go.
β¨ SYNOPSIS β¨
phpunit [options] <directory|file> ...
that's it. that's the whole vibe. you point it at directories or files, you sprinkle options, it runs your tests. iconic.
π DESCRIPTION π
this page is lowkey a mega-list of every option, so I'm breaking it down by the cute little groups the original uses: Configuration, Selection, Execution, Reporting, Logging, and Code Coverage. every single flag stays exactly where it was, promise π«Ά
πΈ Configuration πΈ
the "set me up before anything runs" section. getting-ready-with-me energy β¨
--bootstrap <file>β a PHP script that gets included before the tests run. the pre-game ritual.-c,--configuration <file>β read your configuration from an XML file.--no-configurationβ ignore the default configuration file (phpunit.xml). not me ghosting the default config π.--extension <class>β register a test runner extension with bootstrap<class>.--no-extensionsβ do not register test runner extensions. none. zero. nada.--include-path <path(s)>β prepend PHP'sinclude_pathwith the given path(s).-d <key[=value]>β sets aphp.inivalue.--cache-directory <dir>β specify the cache directory.--generate-configurationβ generate a configuration file with suggested settings.--migrate-configurationβ migrate your configuration file to the current format.--validate-configurationβ validate the XML configuration file. vibe check on your config β .--generate-baseline <file>β generate a baseline for issues.--use-baseline <file>β use a baseline to ignore issues.--ignore-baselineβ do not use a baseline to ignore issues.
π¦ Selection π¦
which tests actually get to show up to the party π
--allβ ignore test selection from the XML configuration file.--list-suitesβ list available test suites.--testsuite <name>β only run tests from the specified test suite(s).--exclude-testsuite <name>β exclude tests from the specified test suite(s).--list-groupsβ list available test groups.--group <name>β only run tests from the specified group(s).--exclude-group <name>β exclude tests from the specified group(s).--covers <name>β only run tests that intend to cover<name>.--uses <name>β only run tests that intend to use<name>.--requires-php-extension <name>β only run tests that require PHP extension<name>.--list-test-filesβ list available test files.--list-test-idsβ list available tests as test IDs.--list-testsβ list available tests.--list-tests-xml <file>β list available tests in XML format.--filter <pattern>β filter which tests to run.--exclude-filter <pattern>β exclude tests for the specified filter pattern.--test-suffix <suffixes>β only search for tests in files with the specified suffix(es). Default:Test.php,.phpt--test-files-file <file>β only run test files listed in file (one file by line).--run-test-id <test-id>β only run the test identified by the specified test ID.--test-id-filter-file <file>β only run tests listed by test ID in file (one test ID per line).
π₯ Execution π₯
how the tests actually run. this is where the drama lives π
--process-isolationβ run each test in a separate PHP process.--globals-backupβ backup and restore$GLOBALSfor each test.--static-backupβ backup and restore static properties for each test.--strict-coverageβ be strict about code coverage metadata.--require-coverage-contributionβ be strict about tests that do not contribute to code coverage.--strict-global-stateβ be strict about changes to global state.--disallow-test-outputβ be strict about output during tests.--enforce-time-limitβ enforce time limit based on test size.--default-time-limit <sec>β timeout in seconds for tests that have no declared size.--do-not-report-useless-testsβ do not report tests that do not test anything. leave them alone, they're figuring themselves out π§--stop-on-defect[=<n>]β stop after the first (or the n-th) error, failure, warning, or risky test.--stop-on-error[=<n>]β stop after the first (or the n-th) error.--stop-on-failure[=<n>]β stop after the first (or the n-th) failure.--stop-on-warning[=<n>]β stop after the first (or the n-th) warning.--stop-on-risky[=<n>]β stop after the first (or the n-th) risky test.--stop-on-deprecation[=<n>]β stop after the first (or the n-th) test that triggered a deprecation.--stop-on-notice[=<n>]β stop after the first (or the n-th) test that triggered a notice.--stop-on-skipped[=<n>]β stop after the first (or the n-th) skipped test.--stop-on-incomplete[=<n>]β stop after the first (or the n-th) incomplete test.--fail-on-empty-test-suiteβ signal failure using the shell exit code when no tests were run.--fail-on-warningβ signal failure using the shell exit code when a warning was triggered.--fail-on-riskyβ signal failure using the shell exit code when a test was considered risky.--fail-on-deprecationβ signal failure using the shell exit code when a deprecation was triggered.--fail-on-phpunit-deprecationβ signal failure using the shell exit code when a PHPUnit deprecation was triggered.--fail-on-phpunit-noticeβ signal failure using the shell exit code when a PHPUnit notice was triggered.--fail-on-phpunit-warningβ signal failure using the shell exit code when a PHPUnit warning was triggered.--fail-on-noticeβ signal failure using the shell exit code when a notice was triggered.--fail-on-skippedβ signal failure using the shell exit code when a test was skipped.--fail-on-incompleteβ signal failure using the shell exit code when a test was marked incomplete.--fail-on-all-issuesβ signal failure using the shell exit code when an issue is triggered.--do-not-fail-on-empty-test-suiteβ do not signal failure using the shell exit code when no tests were run.--do-not-fail-on-warningβ do not signal failure using the shell exit code when a warning was triggered.--do-not-fail-on-riskyβ do not signal failure using the shell exit code when a test was considered risky.--do-not-fail-on-deprecationβ do not signal failure using the shell exit code when a deprecation was triggered.--do-not-fail-on-phpunit-deprecationβ do not signal failure using the shell exit code when a PHPUnit deprecation was triggered.--do-not-fail-on-phpunit-noticeβ do not signal failure using the shell exit code when a PHPUnit notice was triggered.--do-not-fail-on-phpunit-warningβ do not signal failure using the shell exit code when a PHPUnit warning was triggered.--do-not-fail-on-noticeβ do not signal failure using the shell exit code when a notice was triggered.--do-not-fail-on-skippedβ do not signal failure using the shell exit code when a test was skipped.--do-not-fail-on-incompleteβ do not signal failure using the shell exit code when a test was marked incomplete.--cache-resultβ write test results to the cache file.--do-not-cache-resultβ do not write test results to the cache file.--order-by <order>β run tests in order:default|defects|depends|duration-ascending|duration-descending|no-depends|random|reverse|size-ascending|size-descending--resolve-dependenciesβ alias for"--order-by depends".--ignore-dependenciesβ alias for"--order-by no-depends".--random-orderβ alias for"--order-by random".--random-order-seed <N>β use the specified random seed when running tests in random order.--reverse-orderβ alias for"--order-by reverse".
π Reporting π
how it tells you what happened. aesthetics matter, periodt π
--colors=<flag>β use colors in output ("never","auto"or"always").--columns <n>β number of columns to use for progress output.--columns maxβ use the maximum number of columns for progress output.--diff-context <n>β number of context lines shown around changes in diffs (default:3).--stderrβ write toSTDERRinstead ofSTDOUT.--no-progressβ disable output of test execution progress.--no-resultsβ disable output of test results.--no-outputβ disable all output.--display-incompleteβ display details for incomplete tests.--display-skippedβ display details for skipped tests.--display-deprecationsβ display details for deprecations triggered by tests.--display-phpunit-deprecationsβ display details for PHPUnit deprecations.--display-phpunit-noticesβ display details for PHPUnit notices.--display-errorsβ display details for errors triggered by tests.--display-noticesβ display details for notices triggered by tests.--display-warningsβ display details for warnings triggered by tests.--display-all-issuesβ display details for all issues that are triggered.--reverse-listβ print defects in reverse order.--compactβ replace the default progress and result output with compact format.--teamcityβ replace the default progress and result output with TeamCity format.--testdoxβ replace the default result output with TestDox format.--testdox-summaryβ repeat TestDox output for tests with errors, failures, or issues.--debugβ replace the default progress and result output with debugging information.--with-telemetryβ include telemetry information in debugging information output.
β Logging β
saving the receipts π
--log-junit <file>β write test results in JUnit XML format to file.--log-otr <file>β write test results in Open Test Reporting XML format to file.--log-teamcity <file>β write test results in TeamCity format to file.--testdox-html <file>β write test results in TestDox format (HTML) to file.--testdox-text <file>β write test results in TestDox format (plain text) to file.--log-events-text <file>β stream events as plain text to file.--log-events-verbose-text <file>β stream events as plain text with extended information to file.--include-git-informationβ include Git information in supported formats.--no-loggingβ ignore logging configured in the XML configuration file.
π Code Coverage π
the "how much of my code did the tests actually touch" moment π«Ά
--coverage-clover <file>β write code coverage report in Clover XML format to file.--coverage-openclover <file>β write code coverage report in OpenClover XML format to file.--coverage-cobertura <file>β write code coverage report in Cobertura XML format to file.--coverage-crap4j <file>β write code coverage report in Crap4J XML format to file.--coverage-html <dir>β write code coverage report in HTML format to directory.--coverage-php <file>β write serialized code coverage data to file.
that's all of part 1 bestie, and there's more coming so don't go anywhere π
--coverage-text=<file>β drops a code coverage report in text format into file, and if you don't say where, it just vibes to standard output π«Ά ([default: standard output])--only-summary-for-coverage-textβ an option for the text-format coverage report: only show the summary, no scrolling through every file β¨--show-uncovered-for-coverage-textβ another text-format coverage report option: show the uncovered files too, so you can see exactly which parts ghosted the tests π--coverage-xml <dir>β writes the code coverage report in XML format into dir π--exclude-source-from-xml-coverageβ keeps the<source>element out of that XML coverage report, periodt βοΈ--warm-coverage-cacheβ warms up the static analysis cache π₯ cozy--coverage-filter <dir>β puts<dir>in the coverage reporting zone π--branch-coverageβ reports branch coverage on top of line coverage, both, bestie π--path-coverageβ reports path coverage on top of line/branch coverage, we're going deeper π¦--disable-coverage-ignoreβ turns off the metadata that's used for ignoring code coverage π--disable-coverage-targetingβ turns off the metadata that's used for code coverage targeting π―--no-coverageβ straight-up ignores the code coverage reporting you configured in the XML configuration file, like it never happened π
π Miscellaneous π
the little extras, the odds and ends, the cherry on top π
-h,--helpβ prints this usage information, your lil cheat sheet π--versionβ prints the version and peaces out βοΈ--atleast-version <min>β checks that the version is greater than<min>and then exits, quick little sanity check β--check-versionβ checks whether PHPUnit is on the latest version and exits, so you're never out here running dusty code β¨--check-php-configurationβ checks whether your PHP configuration follows best practices, a whole glow-up checkup π©Ί
okay that's genuinely the whole page, bestie, you're officially fluent in phpunit π
this was phpunit version 13.2.6+ds, dated August 2026 β iconic, timeless, no cap ππβ¨
π¦ where this page comes from
- ubuntu stonking: phpunit 13.2.6+ds-1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms