定制 beporter/coverage-ensure 二次开发

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

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

beporter/coverage-ensure

Composer 安装命令:

composer require beporter/coverage-ensure

包简介

PHP CLI script that reads clover.xml coverage reports and returns non-zero when percent coverage is below specified threshold. Intended for use with automated test/build tools like Travis CI, Circle CI, GitHub Actions and Jenkins.

README 文档

README

A composer package that provides a PHP CLI script able to clover.xml coverage reports and return non-zero when percent coverage is below specified threshold. Intended for use with automated test/build tools like Travis CI, Circle CI and Jenkins.

Requirements

  • PHP 7.0+
    • php-xdebug extension
    • phpunit, for generating code coverage reports

Installation

# In your project:
$ composer require --dev beporter/php-coverage-ensure

Usage

Before calling the script, you must produce a clover coverage report for your project. This can be done with PHPUnit.

$ vendor/bin/phpunit --coverage-clover tmp/clover.xml

Then call the script providing the path to a clover XML coverage report file and an optional minimum acceptable percentage.

$ vendor/bin/coverage-ensure tmp/clover.xml 80

Advanced Usage

If you want PHPUnit to always generate a clover report, you can also add the following block to your phpunit.xml or phpunit.xml.dist file:

<?xml version="1.0" encoding="UTF-8"?>
<phpunit
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/6.3/phpunit.xsd"
>
    <!-- ... -->

    <!-- Always generate a clover coverage report. -->
    <logging>
        <log type="coverage-clover" target="tmp/clover.xml"/>
    </logging>

</phpunit>

This package also includes a helper script that can determine the location of your clover report file by reading your phpunit config file:

$ vendor/bin/coverage-ensure `vendor/bin/clover-path-from-phpunit` 80

Contributing

Code of Conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. Translations are available.

Reporting Issues

Please use GitHub Isuses for listing any known defects or issues.

Development

Please fork this repository, create a new topic branch, and submit a pull request for your work.

Credits

This work was originally done as a part of loadsys/cakephp-shell-scripts and broken out here for greater portability/reuse.

License

MIT

Copyright

Copyright © 2018 Brian Porter

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-07-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固