Profiles

Infection supports the use of mutator profiles for the command line and configuration file.

The following configuration file will use the @default profile, but turn off the @function_signature profile.
On top of that, it does not apply the TrueValue mutator on any classes that match the provided ignore patterns. In particular, TrueValue mutator does not mutate the code inside Full\NameSpaced\Class class and inside create() method of all SourceClass classes. Finally, the MethodCallRemoval mutator will ignore line 63 of AnotherClass in the method doSomething. Specifying the line gives the ability to ignore one instance in a method, but still process other instances in the same method.

These ignores can also be added to profiles, to ensure infection is as flexible as you need it.

All profiles are prepended by an @ and in snake case, while all mutators are in PascalCase.

{
"source": {
"directories": [
"src"
]
},
"timeout": 10,
"logs": {
"text": "infection.log"
},
"mutators": {
"@default": true,
"@function_signature": false,
"TrueValue": {
"ignore": [
"NameSpace\\*\\SourceClass::create",
"Full\\NameSpaced\\Class"
]
},
"MethodCallRemoval": {
"ignore": [
"AnotherClass::doSomething::63"
]
}
}
}

The Profiles

Currently, infection supports the following profiles:

@arithmetic

Contains the following mutators:

@boolean

Contains the following mutators:

@cast

Contains the following mutators:

@conditional_boundary

Contains the following mutators:

@conditional_negotiation

Contains the following mutators:

@equal

Contains the following mutators:

@function_signature

Contains the following mutators:

@identical

Contains the following mutators:

@number

Contains the following mutators:

@operator

Contains the following mutators:

@regex

Contains the following mutators:

@removal

Contains the following mutators:

@return_value

Contains the following mutators:

@sort

Contains the following mutators:

@unwrap

Contains the following mutators:

@zero_iteration

Contains the following mutators:

@extensions

Contains the following mutators:

@default

This is the default profile, which currently contains most mutators, and is used if no mutator or profile is chosen.

Feel free to request a new profile to be added in Github’s issues.