Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sebastianbergmann/phpcov
TextUI frontend for php-code-coverage
https://github.com/sebastianbergmann/phpcov
Last synced: about 1 month ago
JSON representation
TextUI frontend for php-code-coverage
- Host: GitHub
- URL: https://github.com/sebastianbergmann/phpcov
- Owner: sebastianbergmann
- License: bsd-3-clause
- Created: 2011-08-28T22:07:36.000Z (about 13 years ago)
- Default Branch: main
- Last Pushed: 2024-04-25T08:52:33.000Z (7 months ago)
- Last Synced: 2024-05-02T06:14:56.388Z (7 months ago)
- Language: PHP
- Homepage:
- Size: 26.3 MB
- Stars: 217
- Watchers: 11
- Forks: 56
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
[![Latest Stable Version](https://poser.pugx.org/phpunit/phpcov/v)](https://packagist.org/packages/phpunit/phpcov)
[![CI Status](https://github.com/sebastianbergmann/phpcov/workflows/CI/badge.svg)](https://github.com/sebastianbergmann/phpcov/actions)
[![Type Coverage](https://shepherd.dev/github/sebastianbergmann/phpcov/coverage.svg)](https://shepherd.dev/github/sebastianbergmann/phpcov)
[![codecov](https://codecov.io/gh/sebastianbergmann/phpcov/branch/main/graph/badge.svg)](https://codecov.io/gh/sebastianbergmann/phpcov)# phpcov
**phpcov** is a command-line frontend for the php-code-coverage library.
## Installation
This tool is distributed as a [PHP Archive (PHAR)](https://php.net/phar):
```
$ wget https://phar.phpunit.de/phpcov.phar$ php phpcov.phar --version
```Using [Phive](https://phar.io/) is the recommended way for managing the tool dependencies of your project:
```
$ phive install phpcov$ ./tools/phpcov --version
```**[It is not recommended to use Composer to download and install this tool.](https://phpunit.readthedocs.io/en/11.0/installation.html#phar-or-composer)**
## Usage
### Executing a PHP script and generating code coverage in Clover XML format
```
$ phpcov execute --clover coverage.xml script.php
phpcov 8.1.0 by Sebastian Bergmann.Generating code coverage report in Clover XML format ... done
```### Merging exported php-code-coverage objects stored in *.cov files
```
$ parallel --gnu ::: \
'phpunit --coverage-php /tmp/coverage/FooTest.cov tests/FooTest' \
'phpunit --coverage-php /tmp/coverage/BarTest.cov tests/BarTest'
``````
$ phpcov merge --clover /tmp/clover.xml /tmp/coverage
phpcov 8.1.0 by Sebastian Bergmann.Generating code coverage report in Clover XML format ... done
```### Patch Coverage
```
$ git diff HEAD^1 > /tmp/patch.txt
``````
$ phpunit --coverage-php /tmp/coverage.cov
``````
$ phpcov patch-coverage --path-prefix /path/to/project /tmp/coverage.cov /tmp/patch.txt
phpcov 8.1.0 by Sebastian Bergmann.1 / 2 changed executable lines covered (50.00%)
Changed executable lines that are not covered:
Example.php:11
```