Skip to content

Commit

Permalink
Merge branch '10.5' into 11.2
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Jun 20, 2024
2 parents 0991687 + 46e02a3 commit a663ff7
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/Framework/TestSuite.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
use const PHP_EOL;
use function array_keys;
use function array_merge;
use function array_shift;
use function array_pop;
use function array_reverse;
use function assert;
use function call_user_func;
use function class_exists;
Expand Down Expand Up @@ -128,7 +129,7 @@ public static function fromClassReflector(ReflectionClass $class, array $groups
$testSuite->addTestMethod($class, $method, $groups);
}

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

public function isEmpty(): bool
{
return empty($this->tests);
foreach ($this as $test) {
if (count($test) !== 0) {
return false;
}
}

return true;
}

/**
Expand Down Expand Up @@ -366,7 +373,7 @@ public function run(): void

$this->wasRun = true;

if (count($this) === 0) {
if ($this->isEmpty()) {
return;
}

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

$tests = array_reverse($tests);

$this->tests = [];
$this->groups = [];

while ($test = array_shift($tests)) {
while (($test = array_pop($tests)) !== null) {
if (TestResultFacade::shouldStop()) {
$emitter->testRunnerExecutionAborted();

Expand Down

0 comments on commit a663ff7

Please sign in to comment.