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.16(5mo ago)34.7k↓100%2GPL-3.0-or-laterPHPPHP &gt;=7.4.0

Since Jan 20Pushed 1mo ago12 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 1mo ago

READMEChangelogDependencies (14)Versions (17)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

50

—

FairBetter than 95% of packages

Maintenance87

Actively maintained with recent releases

Popularity23

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity61

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 ~191 days

Recently: every ~269 days

Total

16

Last Release

159d 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://www.gravatar.com/avatar/f281fc1a5701e1e7002129e0198e12bff5c8ce049377bf1f75b022d588a5bd94?d=identicon)[legoktm](/maintainers/legoktm)

---

Top Contributors

[![legoktm](https://avatars.githubusercontent.com/u/81392?v=4)](https://github.com/legoktm "legoktm (23 commits)")[![reedy](https://avatars.githubusercontent.com/u/67615?v=4)](https://github.com/reedy "reedy (9 commits)")[![umherirrender](https://avatars.githubusercontent.com/u/1174884?v=4)](https://github.com/umherirrender "umherirrender (9 commits)")[![jdforrester](https://avatars.githubusercontent.com/u/881572?v=4)](https://github.com/jdforrester "jdforrester (7 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)")

###  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.2k26.2M1.8k](/packages/infection-infection)[symfony/maker-bundle

Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.

3.4k111.1M563](/packages/symfony-maker-bundle)[phpbench/phpbench

PHP Benchmarking Framework

2.0k13.0M627](/packages/phpbench-phpbench)[vimeo/psalm

A static analysis tool for finding errors in PHP applications

5.8k77.5M6.7k](/packages/vimeo-psalm)[behat/behat

Scenario-oriented BDD framework for PHP

4.0k96.8M1.9k](/packages/behat-behat)[magento/magento2-functional-testing-framework

Magento2 Functional Testing Framework

15511.5M30](/packages/magento-magento2-functional-testing-framework)

PHPackages © 2026

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