Skip to content

Commit

Permalink
Merge pull request #349 from pestphp/teamcity-assertion-fix
Browse files Browse the repository at this point in the history
Fixes the assertion output showing as 0 in the TeamCity logger
  • Loading branch information
lukeraymonddowning committed Jul 16, 2021
2 parents 33e01e3 + 13781dc commit 027e69e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Logging/TeamCity.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
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;
Expand Down Expand Up @@ -137,6 +139,12 @@ public function endTest(Test $test, float $time): void
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),
Expand Down

0 comments on commit 027e69e

Please sign in to comment.