Scroll to navigation

PHPUNIT(1) User Commands PHPUNIT(1)

NAME

phpunit - PHPUnit command line interface

SYNOPSIS

phpunit [options] UnitTest.php
phpunit [options] <directory>

DESCRIPTION

Code Coverage Options:

Generate code coverage report in Clover XML format

--coverage-cobertura <file> Generate code coverage report in Cobertura XML format

Generate code coverage report in Crap4J XML format
Generate code coverage report in HTML format
Export PHP_CodeCoverage object to file
Generate code coverage report in text format [default: standard output]
Generate code coverage report in PHPUnit XML format
Cache static analysis results
Warm static analysis cache
Include <dir> in code coverage analysis
Perform path coverage analysis
Disable annotations for ignoring code coverage
Ignore code coverage configuration

Logging Options:

Log test execution in JUnit XML format to file
Log test execution in TeamCity format to file
Write agile documentation in HTML format to file
Write agile documentation in Text format to file
Write agile documentation in XML format to file
Print defects in reverse order
Ignore logging configuration

Test Selection Options:

List available test suites
Filter which testsuite to run
List available test groups
Only runs tests from the specified group(s)
Exclude tests from the specified group(s)
Only runs tests annotated with "@covers <name>"
Only runs tests annotated with "@uses <name>"
List available tests
List available tests in XML format
Filter which tests to run
Only search for test in files with specified suffix(es). Default: Test.php,.phpt

Test Execution Options:

--dont-report-useless-tests Do not report tests that do not test anything

Be strict about @covers annotation usage
Be strict about changes to global state
Be strict about output during tests
Be strict about resource usage during small tests
Enforce time limit based on test size
Timeout in seconds for tests without @small, @medium or @large
Disallow @todo-annotated tests
Run each test in a separate PHP process
Backup and restore $GLOBALS for each test
Backup and restore static attributes for each test
Use colors in output ("never", "auto" or "always")
Number of columns to use for progress output
Use maximum number of columns for progress output
Write to STDERR instead of STDOUT
Stop execution upon first not-passed test
Stop execution upon first error
Stop execution upon first error or failure
Stop execution upon first warning
Stop execution upon first risky test
Stop execution upon first skipped test
Stop execution upon first incomplete test
Treat incomplete tests as failures
Treat risky tests as failures
Treat skipped tests as failures
Treat tests with warnings as failures
Output more verbose information
Display debugging information
Runs the test(s) repeatedly
Report test execution progress in TeamCity format
Report test execution progress in TestDox format
Only include tests from the specified group(s)
Exclude tests from the specified group(s)
Disable TestDox progress animation
TestListener implementation to use
Run tests in order: default|defects|duration|no-depends|random|reverse|size
Use a specific random seed <N> for random order
Write test results to cache file
Do not write test results to cache file

Configuration Options:

A PHP script that is included as early as possible
A PHP script that is included before the tests run
Read configuration from XML file
Ignore default configuration file (phpunit.xml)
A comma separated list of PHPUnit extensions to load
Do not load PHPUnit extensions
Prepend PHP's include_path with given path(s)
Sets a php.ini value
Specify result cache path and filename
Generate configuration file with suggested settings
Migrate configuration file to current format

Miscellaneous Options:

Prints this usage information
Prints the version and exits
Checks that version is greater than min and exits
Check whether PHPUnit is the latest version
May 2022 phpunit 9.5.20