From 3c27deb02abfc9d94f52669a584c8a88b58faed1 Mon Sep 17 00:00:00 2001 From: Gintautas Miselis Date: Fri, 21 Oct 2022 22:40:51 +0300 Subject: [PATCH] Don't override resultAggregator property in test formats --- src/Codeception/Test/Test.php | 3 +++ src/Codeception/Test/TestCaseWrapper.php | 17 ----------------- src/Codeception/Test/Unit.php | 12 +----------- 3 files changed, 4 insertions(+), 28 deletions(-) diff --git a/src/Codeception/Test/Test.php b/src/Codeception/Test/Test.php index c082c48b5b..916b8c51d7 100644 --- a/src/Codeception/Test/Test.php +++ b/src/Codeception/Test/Test.php @@ -228,6 +228,9 @@ final public function realRun(ResultAggregator $result): void public function getResultAggregator(): ResultAggregator { + if ($this->resultAggregator === null) { + throw new \LogicException('ResultAggregator is not set'); + } return $this->resultAggregator; } diff --git a/src/Codeception/Test/TestCaseWrapper.php b/src/Codeception/Test/TestCaseWrapper.php index 691202d9c9..02c1597cf7 100644 --- a/src/Codeception/Test/TestCaseWrapper.php +++ b/src/Codeception/Test/TestCaseWrapper.php @@ -5,7 +5,6 @@ namespace Codeception\Test; use Codeception\Exception\UselessTestException; -use Codeception\ResultAggregator; use Codeception\Test\Interfaces\Dependent; use Codeception\Test\Interfaces\Descriptive; use Codeception\Test\Interfaces\Reported; @@ -27,8 +26,6 @@ class TestCaseWrapper extends Test implements Reported, Dependent, StrictCoverag { private Metadata $metadata; - private ?ResultAggregator $resultAggregator = null; - /** * @var array */ @@ -80,20 +77,6 @@ public function getMetadata(): Metadata return $this->metadata; } - public function getResultAggregator(): ResultAggregator - { - if ($this->resultAggregator === null) { - throw new \LogicException('ResultAggregator is not set'); - } - return $this->resultAggregator; - } - - public function setResultAggregator(?ResultAggregator $resultAggregator): void - { - $this->resultAggregator = $resultAggregator; - } - - public function fetchDependencies(): array { $names = []; diff --git a/src/Codeception/Test/Unit.php b/src/Codeception/Test/Unit.php index 1814a4d175..048f72f11e 100644 --- a/src/Codeception/Test/Unit.php +++ b/src/Codeception/Test/Unit.php @@ -32,8 +32,6 @@ class Unit extends TestCase implements private ?Metadata $metadata = null; - private ?ResultAggregator $resultAggregator = null; - public function getMetadata(): Metadata { if (!$this->metadata) { @@ -44,15 +42,7 @@ public function getMetadata(): Metadata public function getResultAggregator(): ResultAggregator { - if ($this->resultAggregator === null) { - throw new \LogicException('ResultAggregator is not set'); - } - return $this->resultAggregator; - } - - public function setResultAggregator(?ResultAggregator $resultAggregator): void - { - $this->resultAggregator = $resultAggregator; + throw new \LogicException('This method should not be called, TestCaseWrapper class must be used instead'); } protected function _setUp()