From 164bad437a2496a79932de85f4d000e2ae4b8271 Mon Sep 17 00:00:00 2001 From: luke Date: Fri, 16 Jul 2021 13:10:30 +0100 Subject: [PATCH 1/2] Fixes the assertion output showing as 0 in the TeamCity logger. --- src/Logging/TeamCity.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Logging/TeamCity.php b/src/Logging/TeamCity.php index fded41e4..c482836c 100644 --- a/src/Logging/TeamCity.php +++ b/src/Logging/TeamCity.php @@ -4,6 +4,8 @@ declare(strict_types=1); namespace Pest\Logging; +use PHPUnit\Framework\TestCase; +use PHPUnit\Runner\PhptTestCase; use function getmypid; use Pest\Concerns\Testable; use PHPUnit\Framework\AssertionFailedError; @@ -137,6 +139,12 @@ final class TeamCity extends DefaultResultPrinter return; } + if ($test instanceof TestCase) { + $this->numAssertions += $test->getNumAssertions(); + } elseif ($test instanceof PhptTestCase) { + $this->numAssertions++; + } + $this->printEvent('testFinished', [ self::NAME => $test->getName(), self::DURATION => self::toMilliseconds($time), From 13781dcd1437297f1b1e3cd382af494e2e622310 Mon Sep 17 00:00:00 2001 From: luke Date: Fri, 16 Jul 2021 13:17:33 +0100 Subject: [PATCH 2/2] Fixes the assertion output showing as 0 in the TeamCity logger. --- src/Logging/TeamCity.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Logging/TeamCity.php b/src/Logging/TeamCity.php index c482836c..14704aab 100644 --- a/src/Logging/TeamCity.php +++ b/src/Logging/TeamCity.php @@ -4,15 +4,15 @@ declare(strict_types=1); namespace Pest\Logging; -use PHPUnit\Framework\TestCase; -use PHPUnit\Runner\PhptTestCase; use function getmypid; use Pest\Concerns\Testable; use PHPUnit\Framework\AssertionFailedError; use PHPUnit\Framework\Test; +use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestResult; use PHPUnit\Framework\TestSuite; use PHPUnit\Framework\Warning; +use PHPUnit\Runner\PhptTestCase; use PHPUnit\TextUI\DefaultResultPrinter; use function round; use function str_replace;