Scroll to navigation

PHPUNIT(1) User Commands PHPUNIT(1)

NAME

phpunit - PHPUnit command line interface

SYNOPSIS

phpunit [options] <directory|file> ...

DESCRIPTION

Configuration:

A PHP script that is included before the tests run
Read configuration from XML file
Ignore default configuration file (phpunit.xml)
Do not load PHPUnit extensions
Prepend PHP's include_path with given path(s)
Sets a php.ini value
Specify cache directory
Generate configuration file with suggested settings
Migrate configuration file to current format
Generate baseline for issues
Use baseline to ignore issues
Do not use baseline to ignore issues

Selection:

List available test suites
Only run tests from the specified test suite(s)
Exclude tests from the specified test suite(s)
List available test groups
Only run tests from the specified group(s)
Exclude tests from the specified group(s)
Only run tests that intend to cover <name>
Only run tests that intend to use <name>
List available test files
List available tests
List available tests in XML format
Filter which tests to run
Exclude tests for the specified filter pattern
Only search for test in files with specified suffix(es). Default: Test.php,.phpt

Execution:

Run each test in a separate PHP process
Backup and restore $GLOBALS for each test
Backup and restore static properties for each test
Be strict about code coverage metadata
Be strict about changes to global state
Be strict about output during tests
Enforce time limit based on test size
Timeout in seconds for tests that have no declared size
Do not report tests that do not test anything
Stop after first error, failure, warning, or risky test
Stop after first error
Stop after first failure
Stop after first warning
Stop after first risky test
Stop after first test that triggered a deprecation
Stop after first test that triggered a notice
Stop after first skipped test
Stop after first incomplete test
Signal failure using shell exit code when no tests were run
Signal failure using shell exit code when a warning was triggered
Signal failure using shell exit code when a test was considered risky
Signal failure using shell exit code when a deprecation was triggered
Signal failure using shell exit code when a notice was triggered
Signal failure using shell exit code when a test was skipped
Signal failure using shell exit code when a test was marked incomplete
Write test results to cache file
Do not write test results to cache file
Run tests in order: default|defects|depends|duration|no-depends|random|reverse|size
Use the specified random seed when running tests in random order

Reporting:

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
Disable output of test execution progress
Disable output of test results
Disable all output
Display details for incomplete tests
Display details for skipped tests
Display details for deprecations triggered by tests
Display details for errors triggered by tests
Display details for notices triggered by tests
Display details for warnings triggered by tests
Print defects in reverse order
Replace default progress and result output with TeamCity format
Replace default result output with TestDox format
Replace default progress and result output with debugging information

Logging:

Write test results in JUnit XML format to file
Write test results in TeamCity format to file
Write test results in TestDox format (HTML) to file
Write test results in TestDox format (plain text) to file
Stream events as plain text to file

--log-events-verbose-text <file> Stream events as plain text with extended information to file

Ignore logging configured in the XML configuration file

Code Coverage:

Write code coverage report in Clover XML format to file
Write code coverage report in Cobertura XML format to file
Write code coverage report in Crap4J XML format to file
Write code coverage report in HTML format to directory
Write serialized code coverage data to file
Write code coverage report in text format to file [default: standard output]
Write code coverage report in XML format to directory
Warm static analysis cache
Include <dir> in code coverage reporting
Report path coverage in addition to line coverage
Disable metadata for ignoring code coverage
Ignore code coverage reporting configured in the XML configuration file

Miscellaneous:

Prints this usage information
Prints the version and exits
Checks that version is greater than <min> and exits
Checks whether PHPUnit is the latest version and exits
March 2024 phpunit 11.0.8