Skip to content

Commit adc1510

Browse files
Delete code that was only used by tests in PHPUnit's own test suite (but still run twice for the entire test suite for each test suite that is run)
1 parent 9e77af1 commit adc1510

File tree

1 file changed

+2
-47
lines changed

1 file changed

+2
-47
lines changed

src/Runner/TestSuiteSorter.php

Lines changed: 2 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,6 @@ final class TestSuiteSorter
7676
private array $defectSortOrder = [];
7777
private readonly ResultCache $cache;
7878

79-
/**
80-
* @psalm-var array<string> A list of normalized names of tests before reordering
81-
*/
82-
private array $originalExecutionOrder = [];
83-
84-
/**
85-
* @psalm-var array<string> A list of normalized names of tests affected by reordering
86-
*/
87-
private array $executionOrder = [];
88-
8979
public function __construct(?ResultCache $cache = null)
9080
{
9181
$this->cache = $cache ?? new NullResultCache;
@@ -94,7 +84,7 @@ public function __construct(?ResultCache $cache = null)
9484
/**
9585
* @throws Exception
9686
*/
97-
public function reorderTestsInSuite(Test $suite, int $order, bool $resolveDependencies, int $orderDefects, bool $isRootTestSuite = true): void
87+
public function reorderTestsInSuite(Test $suite, int $order, bool $resolveDependencies, int $orderDefects): void
9888
{
9989
$allowedOrders = [
10090
self::ORDER_DEFAULT,
@@ -117,13 +107,9 @@ public function reorderTestsInSuite(Test $suite, int $order, bool $resolveDepend
117107
throw new InvalidOrderException;
118108
}
119109

120-
if ($isRootTestSuite) {
121-
$this->originalExecutionOrder = $this->calculateTestExecutionOrder($suite);
122-
}
123-
124110
if ($suite instanceof TestSuite) {
125111
foreach ($suite as $_suite) {
126-
$this->reorderTestsInSuite($_suite, $order, $resolveDependencies, $orderDefects, false);
112+
$this->reorderTestsInSuite($_suite, $order, $resolveDependencies, $orderDefects);
127113
}
128114

129115
if ($orderDefects === self::ORDER_DEFECTS_FIRST) {
@@ -132,20 +118,6 @@ public function reorderTestsInSuite(Test $suite, int $order, bool $resolveDepend
132118

133119
$this->sort($suite, $order, $resolveDependencies, $orderDefects);
134120
}
135-
136-
if ($isRootTestSuite) {
137-
$this->executionOrder = $this->calculateTestExecutionOrder($suite);
138-
}
139-
}
140-
141-
public function getOriginalExecutionOrder(): array
142-
{
143-
return $this->originalExecutionOrder;
144-
}
145-
146-
public function getExecutionOrder(): array
147-
{
148-
return $this->executionOrder;
149121
}
150122

151123
private function sort(TestSuite $suite, int $order, bool $resolveDependencies, int $orderDefects): void
@@ -324,21 +296,4 @@ private function resolveDependencies(array $tests): array
324296

325297
return array_merge($newTestOrder, $tests);
326298
}
327-
328-
private function calculateTestExecutionOrder(Test $suite): array
329-
{
330-
$tests = [];
331-
332-
if ($suite instanceof TestSuite) {
333-
foreach ($suite->tests() as $test) {
334-
if (!$test instanceof TestSuite && $test instanceof Reorderable) {
335-
$tests[] = $test->sortId();
336-
} else {
337-
$tests = array_merge($tests, $this->calculateTestExecutionOrder($test));
338-
}
339-
}
340-
}
341-
342-
return $tests;
343-
}
344299
}

0 commit comments

Comments
 (0)