PHPackages                             mediawiki/phpunit-patch-coverage - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. mediawiki/phpunit-patch-coverage

ActiveLibrary[Testing &amp; Quality](/categories/testing)

mediawiki/phpunit-patch-coverage
================================

Generate coverage reports for git patches

0.0.17(2mo ago)34.7k2GPL-3.0-or-laterPHPPHP &gt;=7.4.0

Since Jan 20Pushed 1mo ago11 watchersCompare

[ Source](https://github.com/wikimedia/mediawiki-tools-phpunit-patch-coverage)[ Packagist](https://packagist.org/packages/mediawiki/phpunit-patch-coverage)[ RSS](/packages/mediawiki-phpunit-patch-coverage/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (28)Versions (18)Used By (0)

phpunit-patch-coverage
======================

[](#phpunit-patch-coverage)

A tool to generate coverage reports for a Git patch without actually running the entire coverage report.

Purpose
-------

[](#purpose)

Running PHPUnit coverage reports with Xdebug can be extremely slow. For example, the MediaWiki core coverage report takes around 2 hours to run. This makes it hard for developers to get quick feedback on their patches to see how they affected the overall coverage.

The goal of this is to be able to generate coverage reports for Git patches without running the full coverage tests.

Implementation
--------------

[](#implementation)

We look at the files that were changed in the last commit. We identify classes that were changed, as well as tests that were changed. We then find all the tests that cover those classes, and run the tests with coverage for those files.

Next we'll checkout the previous commit, and re-calculate to see which tests should be run (@covers and modified files). We'll re-run the coverage, and then diff the result!

There are probably plenty of edge cases where this won't work, but I think it will do reasonably well.

Usage
-----

[](#usage)

Add the composer dependency to your project:

```
composer require --dev mediawiki/phpunit-patch-coverage

```

The current working directory must be your git repository. With full options:

```
./vendor/bin/phpunit-patch-coverage check \
 --command "php vendor/bin/phpunit" \
 --sha1 HEAD

```

The options shown in the example above are the defaults, and do not need to be specified again. You may find it useful to have xdebug disabled by default, and then specify it at runtime with: `php -d zend_extension=xdebug.so ...`. Or if you have a PHPUnit wrapper (like MediaWiki), you can call that.

License
-------

[](#license)

phpunit-patch-coverage is (C) 2018 Kunal Mehta, under the terms of the GPL v3 or any later version. See COPYING for more details.

###  Health Score

51

—

FairBetter than 95% of packages

Maintenance88

Actively maintained with recent releases

Popularity23

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~187 days

Recently: every ~289 days

Total

17

Last Release

75d ago

PHP version history (3 changes)0.0.1PHP &gt;=5.5.9

0.0.10PHP &gt;=5.6.99

0.0.11PHP &gt;=7.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/b94d9718c06ec7c3fd7a104bc44966fb7464b9ec7411582343ea35a7a6a85f08?d=identicon)[mediawiki](/maintainers/mediawiki)

![](https://www.gravatar.com/avatar/716c86d71cbf921e7912a505f89d799de398fc0a3af0bd4c8862834b2d642bd7?d=identicon)[wikimedia](/maintainers/wikimedia)

![](https://avatars.githubusercontent.com/u/81392?v=4)[Kunal Mehta](/maintainers/legoktm)[@legoktm](https://github.com/legoktm)

---

Top Contributors

[![legoktm](https://avatars.githubusercontent.com/u/81392?v=4)](https://github.com/legoktm "legoktm (23 commits)")[![umherirrender](https://avatars.githubusercontent.com/u/1174884?v=4)](https://github.com/umherirrender "umherirrender (11 commits)")[![reedy](https://avatars.githubusercontent.com/u/67615?v=4)](https://github.com/reedy "reedy (11 commits)")[![jdforrester](https://avatars.githubusercontent.com/u/881572?v=4)](https://github.com/jdforrester "jdforrester (8 commits)")[![Krinkle](https://avatars.githubusercontent.com/u/156867?v=4)](https://github.com/Krinkle "Krinkle (2 commits)")[![Daimona](https://avatars.githubusercontent.com/u/38216014?v=4)](https://github.com/Daimona "Daimona (2 commits)")[![hashar](https://avatars.githubusercontent.com/u/281689?v=4)](https://github.com/hashar "hashar (1 commits)")[![NovemLinguae](https://avatars.githubusercontent.com/u/79697282?v=4)](https://github.com/NovemLinguae "NovemLinguae (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mediawiki-phpunit-patch-coverage/health.svg)

```
[![Health](https://phpackages.com/badges/mediawiki-phpunit-patch-coverage/health.svg)](https://phpackages.com/packages/mediawiki-phpunit-patch-coverage)
```

###  Alternatives

[infection/infection

Infection is a Mutation Testing framework for PHP. The mutation adequacy score can be used to measure the effectiveness of a test set in terms of its ability to detect faults.

2.2k27.9M2.2k](/packages/infection-infection)[phparkitect/phparkitect

Enforce architectural constraints in your PHP applications

9184.1M24](/packages/phparkitect-phparkitect)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.6k38.2k](/packages/matomo-matomo)[magento/magento2-functional-testing-framework

Magento2 Functional Testing Framework

15311.8M36](/packages/magento-magento2-functional-testing-framework)[jolicode/castor

A lightweight and modern task runner. Automate everything. In PHP.

54642.4k4](/packages/jolicode-castor)[rector/rector-src

Instant Upgrade and Automated Refactoring of any PHP code

136400.8k14](/packages/rector-rector-src)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
