What's new in Infection 0.8.0
Feb 28, 2018
Before upgrading, make sure you know about backward incompatible changes.
excludesetting has been removed from the config file
infection.json. Instead, please use
excludes. This was done to make Infection’s config file compatible with Humbug’s one.
All paths from the config file are now relative to the config file instead of to the current working directory.
In Infection 0.8.0, we have implemented a feature that allows providing existing Coverage Reports from
PhpSpec to Infection.
Why is it needed?
When you use Continuous Integration for your project, probably you are already generating code coverage metrics and run PHPUnit with
phpdbg enabled. Then, you run Infection for mutation testing, which in its turn, generates Code Coverage again for internal needs. This dramatically increases the build time because running your tests with debugger twice requires too much time.
Now it’s possible to reuse already generated coverage in Infection. Assuming you have PHPUnit, just do it as following:
# collect XML and JUnit coverage
Moreover, Infection does not require
phpdbg enabled if coverage is provided. It means, before running Infection you can disable debugger at all.
Not all people have
Xdebug enabled permanently. You may like running scripts by
php -d zend_extension=xdebug.so script.php command in order to debug it.
Before, it was not possible to run Infection in such a way. Since Infection needs debugger just for Initial Tests Run step to generate code coverage, we’ve added a new option where you can pass additional parameters to PHP executable for this process -
Assuming Xdebug is disabled, you can run it as:
infection.phar --initial-tests-php-options="-d zend_extension=xdebug.so"
Two new mutators have been added:
- throw new \FileNotFoundException('...');
You can run only this mutation operator to see how good your MSI is for exceptions testing:
$users = [new User('Ivan', 17), new User('Ann', 23)];
Besides that, we’ve improved mutation testing for Traits, improved Public/Protected Visibility mutators a little bit: they don’t mutate abstract methods anymore.
There was some work to improve Infection Performance. Now, all generated mutants are reused, which reduces filesystem operations.
If you didn’t try Infection with your CI process, now it’s the best time.
Thanks everyone involved!