andrey-tech/phpunit-cobertura-comparator-php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

andrey-tech/phpunit-cobertura-comparator-php

Composer 安装命令:

composer require andrey-tech/phpunit-cobertura-comparator-php

包简介

A lightweight CLI tool to track PHPUnit code coverage regressions using Cobertura reports

README 文档

README

PHPUnit Cobertura Comparator logo

Latest Stable Version PHP workflow Total Downloads PHP Version Require License

PHPUnit Cobertura Comparator is a lightweight CLI tool to track PHPUnit code coverage regressions using Cobertura reports.

Installation

The tool requires PHP version 8.3 or higher.

Install via Composer:

composer require --dev andrey-tech/phpunit-cobertura-comparator-php

Usage

The command line:

./vendor/bin/phpunit-cobertura-comparator <old Cobertura XML file> <new Cobertura XML file>

The optional command line arguments:

  • --no-colors — disable ANSI color output;
  • --ignore-branch-rate — ignore branch-rate in a Cobertura XML file.

An example command line:

./vendor/bin/phpunit-cobertura-comparator cobertura-old.xml cobertura-new.xml 

An example of the console output:

Parsing Cobertura XML file 'cobertura-old.xml'...
Parsing Cobertura XML file 'cobertura-new.xml'...
Coverage comparison: 2025-09-02T11:27:55+00:00 -> 2025-09-03T06:54:35+00:00
Coverage regressions found in 1 class(es):
CLASS: App\Purchase\Fixer
+---------------------------+--------+------------------+--------------------+
| Method                    | Status | Line coverage, % | Branch coverage, % |
+---------------------------+--------+------------------+--------------------+
| CLASS                     | old    | 98.44 -> 92.58   | 92.53 -> 85.22     |
| fix                       | old    | 100.00 -> 100.00 | 100.00 -> 100.00   |
| fixPrice                  | old    | 96.11 -> 100.00  | 94.76 -> 75.33     |
| fixRate                   | new    | x -> 85.90       | x -> 95.24         |
| fixCharges                | del    | 100.00 -> x      | 100.00 -> x        |
+---------------------------+--------+------------------+--------------------+

Exit code: 2. Time: 6 ms. Memory: 1.40/2.00 MiB.

Columns in the table:

  • Method — the method name;
  • Status — the status of the method or class (old, new, del);
  • Line coverage, % — the line coverage of the method or class (old -> new);
  • Branch coverage, % — the branch coverage of the method or class (old -> new).

The tool shows line and branch coverage, measured by PHP Unit, in ANSI colors:

Color Line or branch coverage Status
red The coverage has decreased
yellow Deleted
green The coverage has increased New
white The coverage has not changed Old

Exit codes

The tool defines different exit codes:

Code Description
0 Everything worked as expected and no coverage regressions found
1 An error/exception occurred which has interrupted tool during execution
2 Everything worked as expected but coverage regressions found

Authors and Maintainers

The author and maintainer of PHPUnit Cobertura Comparator is andrey-tech.

License

This tool is licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固