定制 phpunit/phpcov 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

phpunit/phpcov

最新稳定版本:11.0.3

Composer 安装命令:

composer require phpunit/phpcov

包简介

CLI frontend for php-code-coverage

README 文档

README

Latest Stable Version CI Status Type Coverage codecov

phpcov

phpcov is a command-line frontend for the php-code-coverage library.

Installation

This tool is distributed as a PHP Archive (PHAR):

$ wget https://phar.phpunit.de/phpcov-X.Y.phar

$ php phpcov-X.Y.phar --version

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:

$ phive install phpcov

$ ./tools/phpcov --version

It is not recommended to use Composer to download and install this tool.

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

统计信息

  • 总下载量: 19.85M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 240
  • 点击次数: 1
  • 依赖项目数: 664
  • 推荐数: 3

GitHub 信息

  • Stars: 236
  • Watchers: 10
  • Forks: 57
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2026-01-04