Skip to content

Commit

Permalink
Be paranoid
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Jun 14, 2024
1 parent 80ff5f5 commit 04a54e0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Framework/TestSuite.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class TestSuite implements IteratorAggregate, Reorderable, SelfDescribing, Test
*/
private ?array $providedTests = null;
private ?Factory $iteratorFilter = null;
private bool $wasRun = false;

/**
* @psalm-param non-empty-string $name
Expand Down Expand Up @@ -326,6 +327,14 @@ public function groupDetails(): array
*/
public function run(): void
{
if ($this->wasRun) {
// @codeCoverageIgnoreStart
throw new Exception('The tests aggregated by this TestSuite were already run');
// @codeCoverageIgnoreEnd
}

$this->wasRun = true;

if (count($this) === 0) {
return;
}
Expand Down

0 comments on commit 04a54e0

Please sign in to comment.