From ad97b202c4f8e7784ff882f3968ec3b21e8d11fd Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Thu, 2 Mar 2023 21:24:05 +0000 Subject: [PATCH] fix: converter --- src/Logging/TeamCity/Converter.php | 9 ++++++++- src/Logging/TeamCity/TeamCityLogger.php | 1 - tests/.snapshots/Failure.php.inc | 4 ++++ tests/.snapshots/SuccessOnly.php.inc | 4 ++++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/Logging/TeamCity/Converter.php b/src/Logging/TeamCity/Converter.php index 1f0de446..120e2f82 100644 --- a/src/Logging/TeamCity/Converter.php +++ b/src/Logging/TeamCity/Converter.php @@ -180,6 +180,13 @@ final class Converter */ public function getStateFromResult(PhpUnitTestResult $result): State { - return $this->stateGenerator->fromPhpUnitTestResult($result); + $numberOfPassedTests = $result->numberOfTestsRun() + - $result->numberOfTestErroredEvents() + - $result->numberOfTestFailedEvents() + - $result->numberOfTestSkippedEvents() + - $result->numberOfTestsWithTestConsideredRiskyEvents() + - $result->numberOfTestMarkedIncompleteEvents(); + + return $this->stateGenerator->fromPhpUnitTestResult($numberOfPassedTests, $result); } } diff --git a/src/Logging/TeamCity/TeamCityLogger.php b/src/Logging/TeamCity/TeamCityLogger.php index 9e5d6312..85994a84 100644 --- a/src/Logging/TeamCity/TeamCityLogger.php +++ b/src/Logging/TeamCity/TeamCityLogger.php @@ -91,7 +91,6 @@ final class TeamCityLogger public function testMarkedIncomplete(MarkedIncomplete $event): never { - // TODO: when does this trigger? throw ShouldNotHappen::fromMessage('testMarkedIncomplete not implemented.'); } diff --git a/tests/.snapshots/Failure.php.inc b/tests/.snapshots/Failure.php.inc index cc3837bd..cde5f942 100644 --- a/tests/.snapshots/Failure.php.inc +++ b/tests/.snapshots/Failure.php.inc @@ -18,3 +18,7 @@ ##teamcity[testIgnored name='build this one.' message='This test was ignored.' details='' flowId='1234'] ##teamcity[testFinished name='build this one.' duration='100000' flowId='1234'] ##teamcity[testSuiteFinished name='Tests/tests/Failure' flowId='1234'] + + Tests: 2 failed, 1 risky, 2 todos, 1 skipped (2 assertions) + Duration: 1.00s + diff --git a/tests/.snapshots/SuccessOnly.php.inc b/tests/.snapshots/SuccessOnly.php.inc index 5629be43..21e8a362 100644 --- a/tests/.snapshots/SuccessOnly.php.inc +++ b/tests/.snapshots/SuccessOnly.php.inc @@ -4,3 +4,7 @@ ##teamcity[testStarted name='can also pass' locationHint='pest_qn://tests/.tests/SuccessOnly.php::can also pass' flowId='1234'] ##teamcity[testFinished name='can also pass' duration='100000' flowId='1234'] ##teamcity[testSuiteFinished name='Tests/tests/SuccessOnly' flowId='1234'] + + Tests: 2 passed (2 assertions) + Duration: 1.00s +