Skip to content

Commit a663ff7

Browse files
Merge branch '10.5' into 11.2
2 parents 0991687 + 46e02a3 commit a663ff7

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/Framework/TestSuite.php

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
use const PHP_EOL;
1313
use function array_keys;
1414
use function array_merge;
15-
use function array_shift;
15+
use function array_pop;
16+
use function array_reverse;
1617
use function assert;
1718
use function call_user_func;
1819
use function class_exists;
@@ -128,7 +129,7 @@ public static function fromClassReflector(ReflectionClass $class, array $groups
128129
$testSuite->addTestMethod($class, $method, $groups);
129130
}
130131

131-
if (count($testSuite) === 0) {
132+
if ($testSuite->isEmpty()) {
132133
Event\Facade::emitter()->testRunnerTriggeredWarning(
133134
sprintf(
134135
'No tests found in class "%s".',
@@ -297,7 +298,13 @@ public function count(): int
297298

298299
public function isEmpty(): bool
299300
{
300-
return empty($this->tests);
301+
foreach ($this as $test) {
302+
if (count($test) !== 0) {
303+
return false;
304+
}
305+
}
306+
307+
return true;
301308
}
302309

303310
/**
@@ -366,7 +373,7 @@ public function run(): void
366373

367374
$this->wasRun = true;
368375

369-
if (count($this) === 0) {
376+
if ($this->isEmpty()) {
370377
return;
371378
}
372379

@@ -386,10 +393,12 @@ public function run(): void
386393
$tests[] = $test;
387394
}
388395

396+
$tests = array_reverse($tests);
397+
389398
$this->tests = [];
390399
$this->groups = [];
391400

392-
while ($test = array_shift($tests)) {
401+
while (($test = array_pop($tests)) !== null) {
393402
if (TestResultFacade::shouldStop()) {
394403
$emitter->testRunnerExecutionAborted();
395404

0 commit comments

Comments
 (0)