Skip to content

Commit

Permalink
Be paranoid
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Jun 13, 2024
1 parent 4df94e0 commit f9ee2a6
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 @@ -81,6 +81,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 @@ -346,6 +347,14 @@ public function collect(): 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 f9ee2a6

Please sign in to comment.