- Guide
- Playground
- GitHub
-
Ecosystem
Help
Resource Lists
Documentation
- Introduction
- Installation
- Usage
- Command Line Options
- Mutators
- Custom Mutators
- Profiles
- Using with CI
- Mutation Badge, cloud HTML report
- How-to Guides
- Caveats
- Debugging Issues
- Infection Playground
- GitHub Sponsors ♥️
- Supported Test Frameworks
Miscellaneous
- Compare with competitors
Posts
- What's new in Infection 0.26.0
- What's new in Infection 0.25.0
- What's new in Infection 0.24.0
- What's new in Infection 0.23.0
- What's new in Infection 0.21.0
Caveats
Mutations must occur when CodeCoverage has already started
It may happen that a mutation that fails a test isn’t reported as covered.
This can occur when the code-coverage profiler hasn’t started before the mutations occurs.
Take for example:
class SourceClassTest extends \PHPUnit\Framework\TestCase |
If the TrueValue
Boolean Substitution mutator is active, you
would expect the mutation to be correctly covered. But in the provided example the mutation
occurs in the @dataProvider
which runs before the code-coverage driver gets started.
Be sure to check your mutated code runs inside the test in this case, so a workaround can be the following:
class SourceClassTest extends \PHPUnit\Framework\TestCase |
Caught a mistake or want to contribute to the documentation?
Edit this page on Github!