Skip to content

Commit

Permalink
Merge pull request #6590 from Codeception/result-aggregator-cleanup
Browse files Browse the repository at this point in the history
Don't override resultAggregator property in test formats
  • Loading branch information
Naktibalda committed Oct 30, 2022
2 parents d55e5c3 + 3c27deb commit d2e403f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 28 deletions.
3 changes: 3 additions & 0 deletions src/Codeception/Test/Test.php
Expand Up @@ -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;
}

Expand Down
17 changes: 0 additions & 17 deletions src/Codeception/Test/TestCaseWrapper.php
Expand Up @@ -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;
Expand All @@ -27,8 +26,6 @@ class TestCaseWrapper extends Test implements Reported, Dependent, StrictCoverag
{
private Metadata $metadata;

private ?ResultAggregator $resultAggregator = null;

/**
* @var array<string, mixed>
*/
Expand Down Expand Up @@ -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 = [];
Expand Down
12 changes: 1 addition & 11 deletions src/Codeception/Test/Unit.php
Expand Up @@ -32,8 +32,6 @@ class Unit extends TestCase implements

private ?Metadata $metadata = null;

private ?ResultAggregator $resultAggregator = null;

public function getMetadata(): Metadata
{
if (!$this->metadata) {
Expand All @@ -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()
Expand Down

0 comments on commit d2e403f

Please sign in to comment.