PHPackages                             spryker/mutation-testing - 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. spryker/mutation-testing

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

spryker/mutation-testing
========================

Playground repository for Mutation Testing

12PHP

Since Oct 8Pushed 1y ago37 watchersCompare

[ Source](https://github.com/spryker/mutation-testing)[ Packagist](https://packagist.org/packages/spryker/mutation-testing)[ RSS](/packages/spryker-mutation-testing/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Mutation-Testing
================

[](#mutation-testing)

This repository contains some examples and workshops that can be used to play around and understand Mutation-Testing. We are using the great Infection Framework for this which is automatically installed when you set up this project.

Setup
-----

[](#setup)

Install all dependencies

> composer install

Run tests with PHPUnit
----------------------

[](#run-tests-with-phpunit)

### Tests without coverage report

[](#tests-without-coverage-report)

> vendor/bin/phpunit

### With coverage report

[](#with-coverage-report)

> XDEBUG\_MODE=coverage vendor/bin/phpunit --coverage-html tests/output

By default, path coverage is disabled to enable it run

> XDEBUG\_MODE=coverage vendor/bin/phpunit --coverage-html tests/output --path-coverage

Run tests with Infection
------------------------

[](#run-tests-with-infection)

For performance reasons you should always run infection with the `--threads=max` option

> vendor/bin/infection --threads=max

To see which Mutants were created you can run the command with the `--show-mutations` (`-s`) option.

> vendor/bin/infection -s --threads=max

Introduction
------------

[](#introduction)

Mutation testing is a methodology to calculate the effectiveness and efficiency of your test suite. Traditional test frameworks like PHPUnit can generate codecoverage reports which are mostly line based ones.

### Coverage

[](#coverage)

We have three types of coverage

- Line coverage
- Branch coverage
- Path coverage

In PHPUnit you can enable the path coverage in the configuration or via CLI command option. The most efficient one is the path coverage the least one is line coverage. One executed line of code doesn't mean that all possible cases are covered with tests.

### What is Mutation Testing

[](#what-is-mutation-testing)

- Mutates the code under Test
- Gives you an understanding of the test quality
- Tests the effectiveness of your test suite
- Each possible change results in a Mutant
- Tests are executed against the Mutants
- Gives you a way more precise coverage (MSI)

Each line of your code under test will be analysed and possible permuations out of the code will be generated. There are many ways to manipulate the code. See the list below for some of them:

- Changing operators e.g. $a + $b vs. $a - $b
- Remove code lines
- Remove type casting
- Change integer values e.g. 0 to 1
- etc

There are many more checkout  to get an overview.

### Why should you do Mutation Testing

[](#why-should-you-do-mutation-testing)

- Higher confidence in the test quality
- Finds code changes that could break the code
- Shows you what is really covered
- Kind of code review

### References

[](#references)

Mutation Testing [https://en.wikipedia.org/wiki/Mutation\_testing](https://en.wikipedia.org/wiki/Mutation_testing)

Framework

Talk from the Infection Framework owner PHPKonf 2021 - Maks Rafalko: Mutation Testing in PHP

Code Coverage

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity17

Early-stage or recently created project

 Bus Factor1

Top contributor holds 50% of commits — single point of failure

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/10738957?v=4)[Spryker Bot](/maintainers/spryker-bot)[@spryker-bot](https://github.com/spryker-bot)

---

Top Contributors

[![stereomon](https://avatars.githubusercontent.com/u/1382877?v=4)](https://github.com/stereomon "stereomon (2 commits)")[![dereuromark](https://avatars.githubusercontent.com/u/39854?v=4)](https://github.com/dereuromark "dereuromark (1 commits)")[![spryker-release-bot](https://avatars.githubusercontent.com/u/26904324?v=4)](https://github.com/spryker-release-bot "spryker-release-bot (1 commits)")

### Embed Badge

![Health badge](/badges/spryker-mutation-testing/health.svg)

```
[![Health](https://phpackages.com/badges/spryker-mutation-testing/health.svg)](https://phpackages.com/packages/spryker-mutation-testing)
```

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[vimeo/psalm

A static analysis tool for finding errors in PHP applications

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

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M570](/packages/beberlei-assert)[mikey179/vfsstream

Virtual file system to mock the real file system in unit tests.

1.4k108.0M2.7k](/packages/mikey179-vfsstream)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)

PHPackages © 2026

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