Infection

(( gitHubWatchers )) (( gitHubStars )) (( gitHubForks ))

Infection is a PHP mutation testing framework based on AST (Abstract Syntax Tree) mutations.

Infection runs your test suit, mutates the source code with a set of predefined mutators (mutation operators) and collects the results of killed, escaped mutants and timeouts.

After running Infection, you will receive a Mutation Score Indicator and your Mutation Code Coverage.

Installation

Install from a Composer package as a dev dependency (with Composer)

Make sure you have Composer and all dependencies xdebug/phpdbg installed.

Require it as a dev dependency:
composer require --dev infection/infection
Run it:
php vendor/bin/infection

Install from a Composer package as a global CLI utility (with Composer)

Make sure you have Composer and all dependencies xdebug/phpdbg installed.

Require it as a global CLI utility:
composer global require infection/infection
Run it:
infection
Make sure your global vendor binaries directory is in your $PATH environment variable. Check the Composer documentation for more information.

Install from a PHP Archive (with curl or wget)

The PHPUnit documentation has a clear manual on how to install PHARs on Windows.

If you have the Suhosin extension enabled, make sure to allow the execution of PHARs in your php.ini:
suhosin.executor.include.whitelist = phar

Make sure all dependencies are installed: xdebug/phpdbg.

Locally

Download it:
wget -O infection.phar https://github.com/infection/infection/releases/download/X.X.X/infection.phar
or
curl -sSL https://github.com/infection/infection/releases/download/X.X.X/infection.phar -o infection.phar
Use it:
php infection.phar

Globally

Download it:
wget -O infection.phar https://github.com/infection/infection/releases/download/X.X.X/infection.phar
or
curl -sSL https://github.com/infection/infection/releases/download/X.X.X/infection.phar -o infection.phar
Install it as an executable:
chmod a+x infection.phar
sudo mv infection.phar /usr/local/bin/infection
Use it:
infection