henrikbjorn/phpspec-code-coverage
最新稳定版本:3.0.1
Composer 安装命令:
composer require henrikbjorn/phpspec-code-coverage
包简介
Integrates CodeCoverage with PhpSpec
README 文档
README
DEPRECATED: CodeCoverage should not be used with spec testing in order to see how good your tests are. For that reason, and because I don't use it myself, this library is deprecated and will not receive any updates etc. For a maintained fork, you can check leanphp/phpspec-code-coverage.
Install with Composer:
composer require --dev henrikbjorn/phpspec-code-coverage
Enable it in your phpspec.yml file:
extensions: - PhpSpecCodeCoverage\CodeCoverageExtension
Now run your specs with the normal phpspec run and voilà your code coverage will be available in coverage.
Configuration Options
It is possible to control a bit out how the code coverage is done through phpspec.yml. This is done by adding a hash of options to the extension key.
whitelisttakes an array of directories to whitelist (default:lib,src).whitelist_filestakes an array of files to whitelist (default: none).blacklisttakes an array of directories to blacklistblacklist_filestakes an array of files to blacklistformat(optional) could be one or many of:clover,php,text,html(defaulthtml)outputtakes a location relative to the place you are runningphpspec run(default:coverage). If you configure multiple formats, takes a hash of format:output e.g.
extensions: PhpSpecCodeCoverage\CodeCoverageExtension: format: - html - clover output: html: coverage clover: coverage.xml
show_uncovered_filesfor including uncovered files in coverage reports (defaulttrue)lower_upper_boundfor coverage (default35)high_lower_boundfor coverage (default70)
Note: If the clover format option requires you to also set an output location!
Running with phpdbg (PHP 7.x and up)
For faster execution, run phpspec with phpdbg instead of xdebug:
phpdbg -qrr phpspec run
Note: The code coverage extension only works with phpdbg if you're using PHP 7. In PHP 5.6, phpdbg is missing the phpdbg_start_oplog function which is required to generate code coverage.
henrikbjorn/phpspec-code-coverage 适用场景与选型建议
henrikbjorn/phpspec-code-coverage 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 797.57k 次下载、GitHub Stars 达 100, 最近一次更新时间为 2026 年 01 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 henrikbjorn/phpspec-code-coverage 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 henrikbjorn/phpspec-code-coverage 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 797.57k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 100
- 点击次数: 22
- 依赖项目数: 313
- 推荐数: 1
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-04