Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 2 additions & 47 deletions src/Runner/TestSuiteSorter.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,6 @@ final class TestSuiteSorter
private array $defectSortOrder = [];
private readonly ResultCache $cache;

/**
* @psalm-var array<string> A list of normalized names of tests before reordering
*/
private array $originalExecutionOrder = [];

/**
* @psalm-var array<string> A list of normalized names of tests affected by reordering
*/
private array $executionOrder = [];

public function __construct(?ResultCache $cache = null)
{
$this->cache = $cache ?? new NullResultCache;
Expand All @@ -94,7 +84,7 @@ public function __construct(?ResultCache $cache = null)
/**
* @throws Exception
*/
public function reorderTestsInSuite(Test $suite, int $order, bool $resolveDependencies, int $orderDefects, bool $isRootTestSuite = true): void
public function reorderTestsInSuite(Test $suite, int $order, bool $resolveDependencies, int $orderDefects): void
{
$allowedOrders = [
self::ORDER_DEFAULT,
Expand All @@ -117,13 +107,9 @@ public function reorderTestsInSuite(Test $suite, int $order, bool $resolveDepend
throw new InvalidOrderException;
}

if ($isRootTestSuite) {
$this->originalExecutionOrder = $this->calculateTestExecutionOrder($suite);
}

if ($suite instanceof TestSuite) {
foreach ($suite as $_suite) {
$this->reorderTestsInSuite($_suite, $order, $resolveDependencies, $orderDefects, false);
$this->reorderTestsInSuite($_suite, $order, $resolveDependencies, $orderDefects);
}

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

$this->sort($suite, $order, $resolveDependencies, $orderDefects);
}

if ($isRootTestSuite) {
$this->executionOrder = $this->calculateTestExecutionOrder($suite);
}
}

public function getOriginalExecutionOrder(): array
{
return $this->originalExecutionOrder;
}

public function getExecutionOrder(): array
{
return $this->executionOrder;
}

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

return array_merge($newTestOrder, $tests);
}

private function calculateTestExecutionOrder(Test $suite): array
{
$tests = [];

if ($suite instanceof TestSuite) {
foreach ($suite->tests() as $test) {
if (!$test instanceof TestSuite && $test instanceof Reorderable) {
$tests[] = $test->sortId();
} else {
$tests = array_merge($tests, $this->calculateTestExecutionOrder($test));
}
}
}

return $tests;
}
}
76 changes: 0 additions & 76 deletions tests/_files/TestWithDifferentSizes.php

This file was deleted.

70 changes: 0 additions & 70 deletions tests/end-to-end/execution-order/_files/ClonedDependencyTest.php

This file was deleted.

This file was deleted.

38 changes: 0 additions & 38 deletions tests/end-to-end/execution-order/_files/StackTest.php

This file was deleted.

This file was deleted.

This file was deleted.

34 changes: 0 additions & 34 deletions tests/end-to-end/execution-order/cache-result.phpt

This file was deleted.

22 changes: 0 additions & 22 deletions tests/end-to-end/execution-order/dependencies-clone.phpt

This file was deleted.

54 changes: 0 additions & 54 deletions tests/end-to-end/execution-order/dependencies-isolation.phpt

This file was deleted.

Loading
Loading