Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't override resultAggregator property in test formats #6590

Merged
merged 1 commit into from Oct 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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