From 8861dd2401716150c868282089075300e09ba8fa Mon Sep 17 00:00:00 2001 From: luke Date: Sun, 1 Aug 2021 15:40:34 +0100 Subject: [PATCH] Merges with master --- src/Logging/TeamCity.php | 7 +++++-- tests/.snapshots/success.txt | 8 +++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Logging/TeamCity.php b/src/Logging/TeamCity.php index 8ff92b6f..58c329e1 100644 --- a/src/Logging/TeamCity.php +++ b/src/Logging/TeamCity.php @@ -4,8 +4,6 @@ declare(strict_types=1); namespace Pest\Logging; -use ReflectionClass; -use ReflectionProperty; use function getmypid; use Pest\Concerns\Testable; use function Pest\version; @@ -17,6 +15,7 @@ use PHPUnit\Framework\TestSuite; use PHPUnit\Framework\Warning; use PHPUnit\Runner\PhptTestCase; use PHPUnit\TextUI\DefaultResultPrinter; +use ReflectionProperty; use function round; use function str_replace; use function strlen; @@ -309,6 +308,10 @@ final class TeamCity extends DefaultResultPrinter private function removePestFromStackTrace(Throwable $e): void { + if (!property_exists($e, 'serializableTrace')) { + return; + } + $property = new ReflectionProperty($e, 'serializableTrace'); $property->setAccessible(true); $trace = $property->getValue($e); diff --git a/tests/.snapshots/success.txt b/tests/.snapshots/success.txt index 57bc7e1d..9790bb20 100644 --- a/tests/.snapshots/success.txt +++ b/tests/.snapshots/success.txt @@ -585,6 +585,9 @@ PASS Tests\Visual\Help ✓ visual snapshot of help command output + PASS Tests\Visual\JUnit + ✓ it is can successfully call all public methods + PASS Tests\Visual\SingleTestOrDirectory ✓ allows to run a single test ✓ allows to run a directory @@ -594,6 +597,9 @@ WARN Tests\Visual\Success - visual snapshot of test suite on success + PASS Tests\Visual\TeamCity + ✓ it is can successfully call all public methods + PASS Tests\Features\Depends ✓ first ✓ second @@ -608,5 +614,5 @@ ✓ it is a test ✓ it uses correct parent class - Tests: 4 incompleted, 9 skipped, 388 passed + Tests: 4 incompleted, 9 skipped, 390 passed \ No newline at end of file