承接 gotrendier/phpunit-coverage-check 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

gotrendier/phpunit-coverage-check

最新稳定版本:1.0.0

Composer 安装命令:

composer require gotrendier/phpunit-coverage-check

包简介

Check the code coverage using the clover report of phpunit

README 文档

README

Build Status

phpunit-coverage-check

This php script will read the clover xml report from phpunit and calculates the coverage score. Based on the given threshold the script will exit ok of the coverage is higher then the threshold or exit with code 1 if the coverage is lower then the threshold. This script can be used in your continuous deployment environment or for example added to a pre-commit hook.

Installation

The script can be installed using composer. Add this repository as a dependency to the composer.json file.

composer require --dev gotrendier/phpunit-coverage-check

Usage

The script has requires 2 parameters that are mandatory to return the code coverage.

  1. The location of the clover xml file, that's generated by phpunit.
  2. The coverage threshold that is acceptable. Min = 1, Max = 100

Generate the clover.xml file by using phpunit and run the coverage check script: Run the script:

vendor/bin/phpunit --coverage-clover clover.xml
vendor/bin/coverage-check clover.xml 80
vendor/bin/coverage-check clover.xml 80 app
vendor/bin/coverage-check clover.xml 80 --only-percentage
vendor/bin/coverage-check clover.xml 80 --only-percentage app

With the --only-percentage enabled, the CLI command will only return the resulting coverage percentage.

By default, chictrend folder will be measured. If you pass a folder like app after de percentage argument or--only-percentage argument that folder will be measured.

It's also possible to add the coverage report generation to the phpunit.xml.dist add to following line to the xml file:

<logging>
    <log type="coverage-clover" target="clover.xml"/>
</logging>

For more information see the phpunit documentation. Information about the configuration file and commandline options.

统计信息

  • 总下载量: 3.6k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-08-02