📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials PHPUnit Testing Mutation Testing

Mutation Testing

5 min read
Use Infection to run mutation tests — verify your tests catch actual code changes.

Mutation Testing with Infection

composer require --dev infection/infection
./vendor/bin/infection --min-msi=80

# Infection modifies source code and checks if tests catch the changes:
# - Changes + to -
# - Changes === to !==
# - Removes return statements
# - Flips if conditions

# MSI = Mutation Score Indicator
# High MSI = tests genuinely verify behavior
# Low MSI = tests dont actually test much