hanken/phpspec-code-coverage
Composer 安装命令:
composer require hanken/phpspec-code-coverage
包简介
Generate Code Coverage reports for PhpSpec tests
关键字:
README 文档
README
phpspec-code-coverage is a PhpSpec extension that generates Code Coverage reports for PhpSpec tests.
Generating Code Coverage reports allows you to to analyze which parts of your codebase are tested and how well. However, Code Coverage alone should NOT be used as a single metric defining how good your tests are.
Note! This is a maintained fork of henrikbjorn/phpspec-code-coverage package with compatible version numbers for stable releases.
Requirements
- PHP 5.6+ or PHP 7+
- Xdebug or phpdbg extension enabled (PHP 7+ is required for code generation to work with phpdbg).
- PhpSpec v3 or v4
Change Log
Please see CHANGELOG.md for information on recent changes.
Install
Install this package as a development dependency in your project:
$ composer require --dev leanphp/phpspec-code-coverage
Enable extension by editing phpspec.yml of your project:
extensions: LeanPHP\PhpSpec\CodeCoverage\CodeCoverageExtension: ~
This will sufficient to enable Code Coverage generation by using defaults provided by the extension. This extension supports various [configuration options](#Configuration Options). For a fully annotated example configuration file check Configuration section.
Usage
If you execute phpspec run command, you will see code coverage generated in coverage directory (in html format):
$ bin/phpspec run
Running with phpdbg
This extension now supports phpdbg, which results in faster execution when
using more recent versions of PHP. Run phpspec via phpdbg:
$ phpdbg -qrr phpspec run
Note! PHP 7+ is required for code generation to work with phpdbg.
Configuration
You can see fully annotated phpspec.yml example file below, which can be used
as a starting point to further customize the defaults of the extension. The
configuration file below has all of the [Configuration Options](#Configuration
Options).
# phpspec.yml # ... extensions: # ... other extensions ... # leanphp/phpspec-code-coverage LeanPHP\PhpSpec\CodeCoverage\CodeCoverageExtension: # Specify a list of formats in which code coverage report should be # generated. # Default: [html] format: - text - html #- clover #- php # # Specify output file/directory where code coverage report will be # generated. You can configure different output file/directory per # enabled format. # Default: coverage output: html: coverage #clover: coverage.xml #php: coverage.php # # Should uncovered files be included in the reports? # Default: true #show_uncovered_files: true # # Set lower upper bound for code coverage # Default: 35 #lower_upper_bound: 35 # # Set high lower bound for code coverage # Default: 70 #high_lower_bound: 70 # # Whilelist directories for which code generation should be done # Default: [src, lib] # whitelist: - src - lib # # Whiltelist files for which code generation should be done # Default: empty #whilelist_files: #- app/bootstrap.php #- web/index.php # # Blacklist directories for which code generation should NOT be done #blacklist: #- src/legacy # # Blacklist files for which code generation should NOT be done #blacklist_files: #- lib/bootstrap.php
Configuration Options
format(optional) a list of formats in which code coverage should be generated. Can be one or many of:clover,php,text,html(defaulthtml) Note: When usingcloverformat option, you have to configure specificoutputfile for thecloverformat (see below).output(optional) sets an output file/directory where specific code coverage format will be generated. If you configure multiple formats, takes a hash offormat:output(e.g.clover:coverage.xml) (defaultcoverage)show_uncovered_files(optional) for including uncovered files in coverage reports (defaulttrue)lower_upper_bound(optional) sets lower upper bound for code coverage (default35).high_lower_bound(optional) sets high lower bound for code coverage (default70)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 blacklist (default:test, vendor, spec)blacklist_filestakes an array of files to blacklist
Authors
Copyright (c) 2017 ek9 dev@ek9.co (https://ek9.co).
Copyright (c) 2013-2016 Henrik Bjornskov, for portions of code from henrikbjorn/phpspec-code-coverage project.
License
Licensed under MIT License.
hanken/phpspec-code-coverage 适用场景与选型建议
hanken/phpspec-code-coverage 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 19.9k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2017 年 08 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「build」 「test」 「code」 「spec」 「generation」 「tests」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 hanken/phpspec-code-coverage 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hanken/phpspec-code-coverage 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 hanken/phpspec-code-coverage 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Memio's PrettyPrinter, used to generate PHP code from given Model
Testing Suite For Lumen like Laravel does.
A simple library for make Lexer and Parsers to build a language
Dash (LOVE) Docset Builder in PHP (LOVE).
Specification-oriented BDD helpers for PHPUnit
Promotional Codes Generator for Laravel 5.1
统计信息
- 总下载量: 19.9k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 15
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-08-24