Skip to content

Commit

Permalink
Add e2e test to make sure Custom Mutator works as expected
Browse files Browse the repository at this point in the history
- exclude Mutator, Definition, MutatorCategory from being prefixes by Box/Scoper
  • Loading branch information
maks-rafalko committed May 4, 2024
1 parent 27e92c7 commit 727c20d
Show file tree
Hide file tree
Showing 24 changed files with 237 additions and 49 deletions.
2 changes: 1 addition & 1 deletion devTools/Dockerfile
Expand Up @@ -35,7 +35,7 @@ RUN apk add --no-cache \
git \
zip

COPY --from=composer:2.1 /usr/bin/composer /usr/bin/composer
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
COPY memory-limit.ini xdebug.ini ${PHP_INI_DIR}/conf.d/

RUN adduser -h /opt/infection -s /bin/bash -D infection
Expand Down
9 changes: 2 additions & 7 deletions devTools/phpstan-src-baseline.neon
Expand Up @@ -371,17 +371,12 @@ parameters:
path: ../src/Mutator/MutatorResolver.php

-
message: "#^Parameter &\\$mutators by\\-ref type of method Infection\\\\Mutator\\\\MutatorResolver\\:\\:registerFromClass\\(\\) expects array\\<string, array\\<string\\>\\>, array\\<string, array\\<array\\<string\\>\\|string\\>\\> given\\.$#"
message: "#^Parameter &\\$mutators by\\-ref type of method Infection\\\\Mutator\\\\MutatorResolver\\:\\:registerFromClass\\(\\) expects array\\<string, array\\<string, string\\>\\>, array\\<string, array\\<string, array\\<string\\>\\|string\\>\\> given\\.$#"
count: 1
path: ../src/Mutator/MutatorResolver.php

-
message: "#^Parameter &\\$mutators by\\-ref type of method Infection\\\\Mutator\\\\MutatorResolver\\:\\:registerFromClass\\(\\) expects array\\<string, array\\<string\\>\\>, array\\<string, array\\> given\\.$#"
count: 1
path: ../src/Mutator/MutatorResolver.php

-
message: "#^Parameter &\\$mutators by\\-ref type of method Infection\\\\Mutator\\\\MutatorResolver\\:\\:registerFromName\\(\\) expects array\\<string, array\\<string, string\\>\\>, array\\<string, array\\<string\\>\\> given\\.$#"
message: "#^Parameter &\\$mutators by\\-ref type of method Infection\\\\Mutator\\\\MutatorResolver\\:\\:registerFromClass\\(\\) expects array\\<string, array\\<string, string\\>\\>, array\\<string, array\\> given\\.$#"
count: 1
path: ../src/Mutator/MutatorResolver.php

Expand Down
5 changes: 0 additions & 5 deletions devTools/phpstan-src.neon
Expand Up @@ -53,11 +53,6 @@ parameters:
count: 1
path: ../src/Logger/Html/StrykerHtmlReportBuilder.php

-
message: "#^PHPDoc tag @var with type Infection\\\\Mutator\\\\Mutator\\<PhpParser\\\\NodeAbstract\\> is not subtype of native type 'Infection\\\\\\\\Mutator\\\\\\\\Arithmetic\\\\\\\\Assignment'\\|'Infection\\\\\\\\Mutator\\\\\\\\Arithmetic\\\\\\\\AssignmentEqual'\\|'Infection\\\\\\\\Mutator\\\\\\\\Arithmetic\\\\\\\\BitwiseAnd'\\|'Infection\\\\\\\\Mutator\\\\\\\\Arithmetic\\\\\\\\BitwiseNot'\\|'Infection\\\\\\\\Mutator\\\\\\\\Arithmetic\\\\\\\\BitwiseOr'\\|'Infection\\\\\\\\Mutator\\\\\\\\Arithmetic\\\\\\\\BitwiseXor'\\|'Infection\\\\\\\\Mutator\\\\\\\\Arithmetic\\\\\\\\Decrement'\\|'Infection\\\\\\\\Mutator\\\\\\\\Arithmetic\\\\\\\\DivEqual'\\|'Infection\\\\\\\\Mutator\\\\\\\\Arithmetic\\\\\\\\Division'\\|'Infection\\\\\\\\Mutator\\\\\\\\Arithmetic\\\\\\\\Exponentiation'\\|'Infection\\\\\\\\Mutator\\\\\\\\Arithmetic\\\\\\\\Increment'\\|'Infection\\\\\\\\Mutator\\\\\\\\Arithmetic\\\\\\\\Minus'\\|'Infection\\\\\\\\Mutator\\\\\\\\Arithmetic\\\\\\\\MinusEqual'\\|'Infection\\\\\\\\Mutator\\\\\\\\Arithmetic\\\\\\\\ModEqual'\\|'Infection\\\\\\\\Mutator\\\\\\\\Arithmetic\\\\\\\\Modulus'\\|'Infection\\\\\\\\Mutator\\\\\\\\Arithmetic\\\\\\\\MulEqual'\\|'Infection\\\\\\\\Mutator\\\\\\\\Arithmetic\\\\\\\\Multiplication'\\|'Infection\\\\\\\\Mutator\\\\\\\\Arithmetic\\\\\\\\Plus'\\|'Infection\\\\\\\\Mutator\\\\\\\\Arithmetic\\\\\\\\PlusEqual'\\|'Infection\\\\\\\\Mutator\\\\\\\\Arithmetic\\\\\\\\PowEqual'\\|'Infection\\\\\\\\Mutator\\\\\\\\Arithmetic\\\\\\\\RoundingFamily'\\|'Infection\\\\\\\\Mutator\\\\\\\\Arithmetic\\\\\\\\ShiftLeft'\\|'Infection\\\\\\\\Mutator\\\\\\\\Arithmetic\\\\\\\\ShiftRight'\\|'Infection\\\\\\\\Mutator\\\\\\\\Boolean\\\\\\\\ArrayItem'\\|'Infection\\\\\\\\Mutator\\\\\\\\Boolean\\\\\\\\EqualIdentical'\\|'Infection\\\\\\\\Mutator\\\\\\\\Boolean\\\\\\\\FalseValue'\\|'Infection\\\\\\\\Mutator\\\\\\\\Boolean\\\\\\\\IdenticalEqual'\\|'Infection\\\\\\\\Mutator\\\\\\\\Boolean\\\\\\\\InstanceOf_'\\|'Infection\\\\\\\\Mutator\\\\\\\\Boolean\\\\\\\\LogicalAnd'\\|'Infection\\\\\\\\Mutator\\\\\\\\Boolean\\\\\\\\LogicalAndAllSubExprNegation'\\|'Infection\\\\\\\\Mutator\\\\\\\\Boolean\\\\\\\\LogicalAndNegation'\\|'Infection\\\\\\\\Mutator\\\\\\\\Boolean\\\\\\\\LogicalAndSingleSubExprNegation'\\|'Infection\\\\\\\\Mutator\\\\\\\\Boolean\\\\\\\\LogicalLowerAnd'\\|'Infection\\\\\\\\Mutator\\\\\\\\Boolean\\\\\\\\LogicalLowerOr'\\|'Infection\\\\\\\\Mutator\\\\\\\\Boolean\\\\\\\\LogicalNot'\\|'Infection\\\\\\\\Mutator\\\\\\\\Boolean\\\\\\\\LogicalOr'\\|'Infection\\\\\\\\Mutator\\\\\\\\Boolean\\\\\\\\LogicalOrAllSubExprNegation'\\|'Infection\\\\\\\\Mutator\\\\\\\\Boolean\\\\\\\\LogicalOrNegation'\\|'Infection\\\\\\\\Mutator\\\\\\\\Boolean\\\\\\\\LogicalOrSingleSubExprNegation'\\|'Infection\\\\\\\\Mutator\\\\\\\\Boolean\\\\\\\\NotEqualNotIdentical'\\|'Infection\\\\\\\\Mutator\\\\\\\\Boolean\\\\\\\\NotIdenticalNotEqual'\\|'Infection\\\\\\\\Mutator\\\\\\\\Boolean\\\\\\\\TrueValue'\\|'Infection\\\\\\\\Mutator\\\\\\\\Boolean\\\\\\\\Yield_'\\|'Infection\\\\\\\\Mutator\\\\\\\\Cast\\\\\\\\CastArray'\\|'Infection\\\\\\\\Mutator\\\\\\\\Cast\\\\\\\\CastBool'\\|'Infection\\\\\\\\Mutator\\\\\\\\Cast\\\\\\\\CastFloat'\\|'Infection\\\\\\\\Mutator\\\\\\\\Cast\\\\\\\\CastInt'\\|'Infection\\\\\\\\Mutator\\\\\\\\Cast\\\\\\\\CastObject'\\|'Infection\\\\\\\\Mutator\\\\\\\\Cast\\\\\\\\CastString'\\|'Infection\\\\\\\\Mutator\\\\\\\\ConditionalBoundary\\\\\\\\GreaterThan'\\|'Infection\\\\\\\\Mutator\\\\\\\\ConditionalBoundary\\\\\\\\GreaterThanOrEqualTo'\\|'Infection\\\\\\\\Mutator\\\\\\\\ConditionalBoundary\\\\\\\\LessThan'\\|'Infection\\\\\\\\Mutator\\\\\\\\ConditionalBoundary\\\\\\\\LessThanOrEqualTo'\\|'Infection\\\\\\\\Mutator\\\\\\\\ConditionalNegotiation\\\\\\\\Equal'\\|'Infection\\\\\\\\Mutator\\\\\\\\ConditionalNegotiation\\\\\\\\GreaterThanNegotiation'\\|'Infection\\\\\\\\Mutator\\\\\\\\ConditionalNegotiation\\\\\\\\GreaterThanOrEqualToNegotiation'\\|'Infection\\\\\\\\Mutator\\\\\\\\ConditionalNegotiation\\\\\\\\Identical'\\|'Infection\\\\\\\\Mutator\\\\\\\\ConditionalNegotiation\\\\\\\\LessThanNegotiation'\\|'Infection\\\\\\\\Mutator\\\\\\\\ConditionalNegotiation\\\\\\\\LessThanOrEqualToNegotiation'\\|'Infection\\\\\\\\Mutator\\\\\\\\ConditionalNegotiation\\\\\\\\NotEqual'\\|'Infection\\\\\\\\Mutator\\\\\\\\ConditionalNegotiation\\\\\\\\NotIdentical'\\|'Infection\\\\\\\\Mutator\\\\\\\\Extensions\\\\\\\\BCMath'\\|'Infection\\\\\\\\Mutator\\\\\\\\Extensions\\\\\\\\MBString'\\|'Infection\\\\\\\\Mutator\\\\\\\\FunctionSignature\\\\\\\\ProtectedVisibility'\\|'Infection\\\\\\\\Mutator\\\\\\\\FunctionSignature\\\\\\\\PublicVisibility'\\|'Infection\\\\\\\\Mutator\\\\\\\\Loop\\\\\\\\DoWhile'\\|'Infection\\\\\\\\Mutator\\\\\\\\Loop\\\\\\\\For_'\\|'Infection\\\\\\\\Mutator\\\\\\\\Loop\\\\\\\\Foreach_'\\|'Infection\\\\\\\\Mutator\\\\\\\\Loop\\\\\\\\While_'\\|'Infection\\\\\\\\Mutator\\\\\\\\Number\\\\\\\\DecrementInteger'\\|'Infection\\\\\\\\Mutator\\\\\\\\Number\\\\\\\\IncrementInteger'\\|'Infection\\\\\\\\Mutator\\\\\\\\Number\\\\\\\\OneZeroFloat'\\|'Infection\\\\\\\\Mutator\\\\\\\\Operator\\\\\\\\AssignCoalesce'\\|'Infection\\\\\\\\Mutator\\\\\\\\Operator\\\\\\\\Break_'\\|'Infection\\\\\\\\Mutator\\\\\\\\Operator\\\\\\\\Catch_'\\|'Infection\\\\\\\\Mutator\\\\\\\\Operator\\\\\\\\Coalesce'\\|'Infection\\\\\\\\Mutator\\\\\\\\Operator\\\\\\\\Concat'\\|'Infection\\\\\\\\Mutator\\\\\\\\Operator\\\\\\\\Continue_'\\|'Infection\\\\\\\\Mutator\\\\\\\\Operator\\\\\\\\ElseIfNegation'\\|'Infection\\\\\\\\Mutator\\\\\\\\Operator\\\\\\\\Finally_'\\|'Infection\\\\\\\\Mutator\\\\\\\\Operator\\\\\\\\IfNegation'\\|'Infection\\\\\\\\Mutator\\\\\\\\Operator\\\\\\\\NullSafeMethodCall'\\|'Infection\\\\\\\\Mutator\\\\\\\\Operator\\\\\\\\NullSafePropertyCall'\\|'Infection\\\\\\\\Mutator\\\\\\\\Operator\\\\\\\\SpreadAssignment'\\|'Infection\\\\\\\\Mutator\\\\\\\\Operator\\\\\\\\SpreadOneItem'\\|'Infection\\\\\\\\Mutator\\\\\\\\Operator\\\\\\\\SpreadRemoval'\\|'Infection\\\\\\\\Mutator\\\\\\\\Operator\\\\\\\\Ternary'\\|'Infection\\\\\\\\Mutator\\\\\\\\Operator\\\\\\\\Throw_'\\|'Infection\\\\\\\\Mutator\\\\\\\\Regex\\\\\\\\PregMatchMatches'\\|'Infection\\\\\\\\Mutator\\\\\\\\Regex\\\\\\\\PregMatchRemoveCaret'\\|'Infection\\\\\\\\Mutator\\\\\\\\Regex\\\\\\\\PregMatchRemoveDollar'\\|'Infection\\\\\\\\Mutator\\\\\\\\Regex\\\\\\\\PregMatchRemoveFlags'\\|'Infection\\\\\\\\Mutator\\\\\\\\Regex\\\\\\\\PregQuote'\\|'Infection\\\\\\\\Mutator\\\\\\\\Removal\\\\\\\\ArrayItemRemoval'\\|'Infection\\\\\\\\Mutator\\\\\\\\Removal\\\\\\\\CatchBlockRemoval'\\|'Infection\\\\\\\\Mutator\\\\\\\\Removal\\\\\\\\CloneRemoval'\\|'Infection\\\\\\\\Mutator\\\\\\\\Removal\\\\\\\\ConcatOperandRemoval'\\|'Infection\\\\\\\\Mutator\\\\\\\\Removal\\\\\\\\FunctionCallRemoval'\\|'Infection\\\\\\\\Mutator\\\\\\\\Removal\\\\\\\\MatchArmRemoval'\\|'Infection\\\\\\\\Mutator\\\\\\\\Removal\\\\\\\\MethodCallRemoval'\\|'Infection\\\\\\\\Mutator\\\\\\\\Removal\\\\\\\\SharedCaseRemoval'\\|'Infection\\\\\\\\Mutator\\\\\\\\ReturnValue\\\\\\\\ArrayOneItem'\\|'Infection\\\\\\\\Mutator\\\\\\\\ReturnValue\\\\\\\\FloatNegation'\\|'Infection\\\\\\\\Mutator\\\\\\\\ReturnValue\\\\\\\\FunctionCall'\\|'Infection\\\\\\\\Mutator\\\\\\\\ReturnValue\\\\\\\\IntegerNegation'\\|'Infection\\\\\\\\Mutator\\\\\\\\ReturnValue\\\\\\\\NewObject'\\|'Infection\\\\\\\\Mutator\\\\\\\\ReturnValue\\\\\\\\This'\\|'Infection\\\\\\\\Mutator\\\\\\\\ReturnValue\\\\\\\\YieldValue'\\|'Infection\\\\\\\\Mutator\\\\\\\\Sort\\\\\\\\Spaceship'\\|'Infection\\\\\\\\Mutator\\\\\\\\SyntaxError'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapArrayChangeKeyCase'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapArrayChunk'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapArrayColumn'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapArrayCombine'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapArrayDiff'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapArrayDiffAssoc'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapArrayDiffKey'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapArrayDiffUassoc'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapArrayDiffUkey'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapArrayFilter'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapArrayFlip'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapArrayIntersect'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapArrayIntersectAssoc'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapArrayIntersectKey'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapArrayIntersectUassoc'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapArrayIntersectUkey'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapArrayKeys'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapArrayMap'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapArrayMerge'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapArrayMergeRecursive'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapArrayPad'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapArrayReduce'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapArrayReplace'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapArrayReplaceRecursive'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapArrayReverse'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapArraySlice'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapArraySplice'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapArrayUdiff'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapArrayUdiffAssoc'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapArrayUdiffUassoc'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapArrayUintersect'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapArrayUintersectAssoc'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapArrayUintersectUassoc'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapArrayUnique'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapArrayValues'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapFinally'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapLcFirst'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapLtrim'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapRtrim'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapStrIreplace'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapStrRepeat'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapStrReplace'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapStrRev'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapStrShuffle'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapStrToLower'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapStrToUpper'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapSubstr'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapTrim'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapUcFirst'\\|'Infection\\\\\\\\Mutator\\\\\\\\Unwrap\\\\\\\\UnwrapUcWords'\\.$#"
count: 1
path: ../src/Logger/Html/StrykerHtmlReportBuilder.php

-
message: "#^Generator expects value type list\\<PhpParser\\\\Node\\\\Stmt\\>, array\\<PhpParser\\\\Node\\\\Stmt\\> given\\.$#"
count: 1
Expand Down
5 changes: 5 additions & 0 deletions scoper.inc.php
Expand Up @@ -35,6 +35,11 @@

return [
'prefix' => 'Infected',
'exclude-classes' => [
'Infection\Mutator\Definition',
'Infection\Mutator\Mutator',
'Infection\Mutator\MutatorCategory',
],
'exclude-constants' => [
// Symfony global constants
'/^SYMFONY\_[\p{L}_]+$/',
Expand Down
1 change: 1 addition & 0 deletions src/Logger/Html/StrykerHtmlReportBuilder.php
Expand Up @@ -64,6 +64,7 @@
use function Safe\file_get_contents;
use function Safe\preg_match;
use function Safe\preg_split;
use function sprintf;
use function str_starts_with;
use function strlen;
use function substr;
Expand Down
4 changes: 1 addition & 3 deletions src/Mutant/MutantExecutionResult.php
Expand Up @@ -52,7 +52,6 @@ class MutantExecutionResult
{
private readonly string $detectionStatus;
private readonly string $mutatorClass;
private readonly string $mutatorName;

/**
* @param Deferred<string> $mutantDiff
Expand All @@ -67,7 +66,7 @@ public function __construct(
private readonly Deferred $mutantDiff,
private readonly string $mutantHash,
string $mutatorClass,
string $mutatorName,
private readonly string $mutatorName,
private readonly string $originalFilePath,
private readonly int $originalStartingLine,
private readonly int $originalEndingLine,
Expand All @@ -82,7 +81,6 @@ public function __construct(

$this->detectionStatus = $detectionStatus;
$this->mutatorClass = $mutatorClass;
$this->mutatorName = $mutatorName;
}

public static function createFromNonCoveredMutant(Mutant $mutant): self
Expand Down
7 changes: 3 additions & 4 deletions src/Mutation/Mutation.php
Expand Up @@ -44,6 +44,7 @@
use Infection\TestFramework\Coverage\JUnit\JUnitTestCaseTimeAdder;
use function md5;
use PhpParser\Node;
use function sprintf;
use Webmozart\Assert\Assert;

/**
Expand All @@ -52,8 +53,7 @@
*/
class Mutation
{
private string $mutatorClass;
private readonly string $mutatorName;
private readonly string $mutatorClass;
/** @var array<string|int|float> */
private readonly array $attributes;
private readonly bool $coveredByTests;
Expand All @@ -70,7 +70,7 @@ public function __construct(
private readonly string $originalFilePath,
private readonly array $originalFileAst,
string $mutatorClass,
string $mutatorName,
private readonly string $mutatorName,
array $attributes,
private readonly string $mutatedNodeClass,
private readonly MutatedNode $mutatedNode,
Expand All @@ -83,7 +83,6 @@ public function __construct(
Assert::keyExists($attributes, $key);
}
$this->mutatorClass = $mutatorClass;
$this->mutatorName = $mutatorName;
$this->attributes = array_intersect_key($attributes, array_flip(MutationAttributeKeys::ALL));
$this->coveredByTests = $tests !== [];
}
Expand Down
3 changes: 0 additions & 3 deletions src/Mutator/Definition.php
Expand Up @@ -37,9 +37,6 @@

use Webmozart\Assert\Assert;

/**
* @internal
*/
final class Definition
{
private readonly string $category;
Expand Down
1 change: 0 additions & 1 deletion src/Mutator/Mutator.php
Expand Up @@ -38,7 +38,6 @@
use PhpParser\Node;

/**
* @internal
* @template TNode of Node
*/
interface Mutator
Expand Down
3 changes: 0 additions & 3 deletions src/Mutator/MutatorCategory.php
Expand Up @@ -37,9 +37,6 @@

use Infection\CannotBeInstantiated;

/**
* @internal
*/
final class MutatorCategory
{
use CannotBeInstantiated;
Expand Down
1 change: 0 additions & 1 deletion src/Mutator/MutatorFactory.php
Expand Up @@ -35,7 +35,6 @@

namespace Infection\Mutator;

use function array_flip;
use function end;
use function explode;
use function is_a;
Expand Down
3 changes: 2 additions & 1 deletion src/Mutator/MutatorResolver.php
Expand Up @@ -42,6 +42,7 @@
use function class_exists;
use function in_array;
use InvalidArgumentException;
use function is_subclass_of;
use function sprintf;
use stdClass;

Expand Down Expand Up @@ -116,7 +117,7 @@ public function resolve(array $mutatorSettings): array
self::registerFromClass(
$mutatorOrProfile,
$resolvedSettings,
$mutators
$mutators,
);

continue;
Expand Down
2 changes: 1 addition & 1 deletion tests/add_new_e2e
Expand Up @@ -17,7 +17,7 @@ cp -r Example_Test/src "$dirname"/src
cp -r Example_Test/tests $dirname/tests
cp Example_Test/composer.json $dirname/composer.json
cp Example_Test/expected-output.txt $dirname/expected-output.txt
cp Example_Test/infection.json $dirname/infection.json
cp Example_Test/infection.json5 $dirname/infection.json5
cp Example_Test/phpunit.xml $dirname/phpunit.xml
cp Example_Test/README.md $dirname/README.md

Expand Down
9 changes: 9 additions & 0 deletions tests/e2e/Custom_Mutator/README.md
@@ -0,0 +1,9 @@
# Title

* Link to github ticket if relevant

## Summary
Short summary of the ticket

## Full Ticket
Full github ticket
15 changes: 15 additions & 0 deletions tests/e2e/Custom_Mutator/composer.json
@@ -0,0 +1,15 @@
{
"require-dev": {
"phpunit/phpunit": "^9.5.5"
},
"autoload": {
"psr-4": {
"Custom_Mutator\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Custom_Mutator\\Test\\": "tests/"
}
}
}
10 changes: 10 additions & 0 deletions tests/e2e/Custom_Mutator/expected-output.txt
@@ -0,0 +1,10 @@
Total: 1

Killed: 1
Errored: 0
Syntax Errors: 0
Escaped: 0
Timed Out: 0
Skipped: 0
Ignored: 0
Not Covered: 0
20 changes: 20 additions & 0 deletions tests/e2e/Custom_Mutator/infection.json5
@@ -0,0 +1,20 @@
{
"$schema": "../../../resources/schema.json",
"timeout": 25,
"source": {
"directories": [
"src"
],
"excludes": [
"Mutator/CustomMutator.php"
]
},
"mutators": {
"@default": false,
"Custom_Mutator\\Mutator\\CustomMutator": true
},
"logs": {
"summary": "infection.log"
},
"tmpDir": "."
}
18 changes: 18 additions & 0 deletions tests/e2e/Custom_Mutator/phpunit.xml
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="./vendor/autoload.php"
colors="true"
>
<testsuites>
<testsuite name="Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>

<coverage>
<include>
<directory>./src/</directory>
</include>
</coverage>
</phpunit>

0 comments on commit 727c20d

Please sign in to comment.