Download the PHP package phpunit/phpcov without Composer
On this page you can find all versions of the php package phpunit/phpcov. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download phpunit/phpcov
More information about phpunit/phpcov
Files in phpunit/phpcov
Package phpcov
Short Description CLI frontend for php-code-coverage
License BSD-3-Clause
Homepage https://github.com/sebastianbergmann/phpcov
Informations about the package phpcov
phpcov
phpcov is a command-line frontend for the php-code-coverage library.
Installation
This tool is distributed as a PHP Archive (PHAR):
Please replace X.Y with the version of PHPCOV you are interested in.
Using Phive is the recommended way for managing the tool dependencies of your project:
It is not recommended to use Composer to download and install this tool.
Usage
Merging serialized code coverage data
When you run PHPUnit with --coverage-php, it writes serialized code coverage data to a .cov file.
The phpcov merge command merges multiple .cov files into a single code coverage report.
This is useful when you run test suites in parallel or across separate processes and want to combine the results into one report.
Example
Run your test suites separately, each writing their own .cov file:
Then merge the .cov files and generate a report:
All .cov files in the specified directory will be merged.
You can generate reports in multiple formats at once:
Exporting merged data
Use --php to write the merged coverage data back to a .cov file:
Merging on a different machine
The serialized .cov files store file paths relative to a base path (the common path prefix of all covered files).
When generating reports, the source files must be readable so that they can be analysed.
If you are merging .cov files on a different machine than where the tests were run, and the source code is located at a different path, use --source to specify where the source code is on the current machine:
Relaxing merge requirements
By default, phpcov merge requires that all .cov files were created using the same PHP version, the same code coverage driver, and (when present) the same Git state. If these do not match, the merge will fail.
You can relax these requirements with the following options:
| Option | Effect |
|---|---|
--do-not-require-matching-git-information |
Allow merging files with different git state |
--do-not-require-matching-php-version |
Allow merging files from different PHP versions |
--do-not-require-matching-code-coverage-driver |
Allow merging files from different coverage drivers |
For example, to merge .cov files that were collected with different PHP versions:
Available Report Formats
| Option | Format |
|---|---|
--clover <file> |
Clover XML |
--openclover <file> |
OpenClover XML |
--cobertura <file> |
Cobertura XML |
--crap4j <file> |
Crap4J XML |
--html <directory> |
HTML |
--php <file> |
Serialized PHP (.cov) |
--text <file> |
Plain text |
--xml <directory> |
PHPUnit XML |
Patch Coverage
The phpcov patch-coverage command calculates code coverage for the lines changed in a patch (unified diff).
It reports how many of the changed executable lines are covered by tests.
Example
Generate a unified diff and collect code coverage:
Then calculate patch coverage:
The command exits with code 0 when all changed executable lines are covered.
It exits with 1 when some changed executable lines are not covered.
It exits with 2 when no changed executable lines could be detected. This usually indicates a path mismatch.
The --path-prefix option
The --path-prefix option is needed when the file paths in the patch do not match the file paths in the coverage data.
The serialized .cov file stores file paths relative to a base path.
The patch file contains paths relative to wherever git diff (or equivalent) was run.
When both are relative to the same project root directory, which is the common case, they match and --path-prefix is not needed.
When the paths do not match, --path-prefix specifies the directory to prepend to the paths in the patch so that they can be resolved against the coverage data.
For example, if the diff was generated from a parent directory and contains paths like project/src/Foo.php, but the coverage data has paths relative to the project root (src/Foo.php), you would use:
All versions of phpcov with dependencies
phpunit/php-code-coverage Version ^14.1.3
phpunit/php-file-iterator Version ^7.0.0
sebastian/cli-parser Version ^5.0.0
sebastian/diff Version ^8.1.0
sebastian/version Version ^7.0.0