From 86e423ccb52886c44549a4fb527ea89d898c3bab Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Sun, 12 Sep 2021 06:38:51 +0900 Subject: [PATCH] Count syntax errors caused by a mutatan as a failure of a mutant (#1571) Fixes #1569, related to #1555 --- src/Metrics/Calculator.php | 2 +- tests/phpunit/Logger/JsonLoggerTest.php | 4 ++-- tests/phpunit/Logger/PerMutatorLoggerTest.php | 4 ++-- tests/phpunit/Metrics/CalculatorTest.php | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Metrics/Calculator.php b/src/Metrics/Calculator.php index 204377a16..47601a3f2 100644 --- a/src/Metrics/Calculator.php +++ b/src/Metrics/Calculator.php @@ -77,7 +77,7 @@ public static function fromMetrics(MetricsCalculator $calculator): self return new self( $calculator->getRoundingPrecision(), $calculator->getKilledCount(), - $calculator->getErrorCount(), + $calculator->getErrorCount() + $calculator->getSyntaxErrorCount(), $calculator->getTimedOutCount(), $calculator->getNotTestedCount(), $calculator->getTestedMutantsCount() diff --git a/tests/phpunit/Logger/JsonLoggerTest.php b/tests/phpunit/Logger/JsonLoggerTest.php index f3fc9c0db..67bd11bde 100644 --- a/tests/phpunit/Logger/JsonLoggerTest.php +++ b/tests/phpunit/Logger/JsonLoggerTest.php @@ -112,9 +112,9 @@ public function metricsProvider(): iterable 'syntaxErrorCount' => 2, 'skippedCount' => 2, 'timeOutCount' => 2, - 'msi' => 50, + 'msi' => 66.67, 'mutationCodeCoverage' => 83.33, - 'coveredCodeMsi' => 60, + 'coveredCodeMsi' => 80, ], 'escaped' => [ [ diff --git a/tests/phpunit/Logger/PerMutatorLoggerTest.php b/tests/phpunit/Logger/PerMutatorLoggerTest.php index d9a9262ba..4c4455c15 100644 --- a/tests/phpunit/Logger/PerMutatorLoggerTest.php +++ b/tests/phpunit/Logger/PerMutatorLoggerTest.php @@ -80,8 +80,8 @@ public function metricsProvider(): iterable | Mutator | Mutations | Killed | Escaped | Errors | Syntax Errors | Timed Out | Skipped | MSI (%s) | Covered MSI (%s) | | --------- | --------- | ------ | ------- | ------ | ------------- | --------- | ------- | -------- | ---------------- | -| For_ | 7 | 1 | 1 | 1 | 1 | 1 | 1 | 50.00 | 60.00 | -| PregQuote | 7 | 1 | 1 | 1 | 1 | 1 | 1 | 50.00 | 60.00 | +| For_ | 7 | 1 | 1 | 1 | 1 | 1 | 1 | 66.67 | 80.00 | +| PregQuote | 7 | 1 | 1 | 1 | 1 | 1 | 1 | 66.67 | 80.00 | TXT ]; diff --git a/tests/phpunit/Metrics/CalculatorTest.php b/tests/phpunit/Metrics/CalculatorTest.php index cfd726cfa..da986e5d8 100644 --- a/tests/phpunit/Metrics/CalculatorTest.php +++ b/tests/phpunit/Metrics/CalculatorTest.php @@ -174,9 +174,9 @@ public function metricsCalculatorProvider(): iterable yield 'nominal' => [ $this->createCompleteMetricsCalculator(), - 50., // 14 total mutations; 2 skipped; 6 of 12 are killed => 50% + 66.67, // 14 total mutations; 2 skipped; 8 of 12 are killed => 66.67% 83.33, // 14 total mutations; 2 skipped & 2 not covered; => 10 of 12 => 83.33% - 60.0, // 14 total mutations; 2 skipped & 2 not covered; 6 of 10 are killed => 60% + 80.0, // 14 total mutations; 2 skipped & 2 not covered; 8 of 10 are killed => 80% ]; } }