Skip to content

Commit 04a54e0

Browse files
Be paranoid
1 parent 80ff5f5 commit 04a54e0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Framework/TestSuite.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ class TestSuite implements IteratorAggregate, Reorderable, SelfDescribing, Test
8080
*/
8181
private ?array $providedTests = null;
8282
private ?Factory $iteratorFilter = null;
83+
private bool $wasRun = false;
8384

8485
/**
8586
* @psalm-param non-empty-string $name
@@ -326,6 +327,14 @@ public function groupDetails(): array
326327
*/
327328
public function run(): void
328329
{
330+
if ($this->wasRun) {
331+
// @codeCoverageIgnoreStart
332+
throw new Exception('The tests aggregated by this TestSuite were already run');
333+
// @codeCoverageIgnoreEnd
334+
}
335+
336+
$this->wasRun = true;
337+
329338
if (count($this) === 0) {
330339
return;
331340
}

0 commit comments

Comments
 (0)