guitarneck/php-coverage

PHP 覆盖率报告工具和框架

1.0.0 2022-11-28 22:05 UTC

This package is auto-updated.

Last update: 2024-09-29 02:02:27 UTC


README

Version 1.0.0 GitHub release (latest by date) GitHub last commit Packagist Version Packagist PHP Version Support Packagist Downloads GitHub license Keep a Changelog v1.0.0

PHP 覆盖率

A PHP 框架,用于检索代码覆盖率并获取以各种格式生成的报告。

可以与以下覆盖率处理器一起使用

并导出以下格式

  • clover
  • 覆盖率
  • coveralls
  • dot (仅限 xdebug)
  • dump (仅限 xdebug)
  • export (PHP 导出)
  • json (PHP 字符串化)
  • lcov
  • raw
  • serialize (PHP 序列化)

目录

安装

composer require guitarneck/php-coverage --dev

命令

  • 使用 php
$ php bin/coverage <file> [args...]
  • 使用 phpdbg
$ phpdbg -qrr bin/coverage <file> [args...]

选项

   --debug                                Show debug informations.

   --excludes=,--excludes,-x              The paths to exclude. Separated by ','.
                                          Ex: vendor/,tests/,inc/lib/

   --format=,--format,-f                  The file format to be generated.
                                          [clover|coverage|coveralls|dot|dump|export|json|lcov|raw|serialize]
                                          dft: coverage

   --handler=,--handler                   The handler to use for coverage.
                                          [xdebug|phpdbg|pcov]
                                          dft: xdebug

   --help,-h                              This help page

   --includes=,--includes,-i              The paths to include. Separated by ','.
                                          Ex: src/,inc/

   --no-extra-filter                      Do not apply extra filtering (includes & excludes).

   --output-path=,--output-path,-p        The paths to output. Separated by ','.
                                          Ex: {DIR},..,reports
                                          - {DIR}: __DIR__ ('coverage/sources')
                                          - ..   : parent path

配置

默认配置可以设置在 sources/Coverage.json

使用 .dot

Grahpviz 是开源的图形可视化软件。

$ dot -Tsvg reports\\Hello.dot > Hello.svg

许可证

MIT © guitarneck