Skip to content

Commit

Permalink
Move printing of test suite loader related warnings from TestSuite to…
Browse files Browse the repository at this point in the history
… TestRunner
  • Loading branch information
sebastianbergmann committed Mar 31, 2020
1 parent 9331b00 commit 10da552
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/Framework/TestSuite.php
Original file line number Diff line number Diff line change
Expand Up @@ -566,15 +566,6 @@ public function run(TestResult $result = null): TestResult
return $result;
}

if (\count($this->warnings) !== 0) {
echo \implode(
\PHP_EOL,
\array_unique($this->warnings)
),
\PHP_EOL,
\PHP_EOL;
}

/** @psalm-var class-string $className */
$className = $this->name;
$hookMethods = TestUtil::getHookMethods($className);
Expand Down Expand Up @@ -780,6 +771,19 @@ public function injectFilter(Factory $filter): void
}
}

public function hasWarnings(): bool
{
return !empty($this->warnings);
}

public function warningsAsString(): string
{
return \implode(
\PHP_EOL,
\array_unique($this->warnings)
);
}

/**
* Creates a default TestResult object.
*/
Expand Down
4 changes: 4 additions & 0 deletions src/TextUI/TestRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,10 @@ public function run(Test $suite, array $arguments = [], bool $exit = true): Test
}
}

if ($suite->hasWarnings()) {
$this->write($suite->warningsAsString() . \PHP_EOL . \PHP_EOL);
}

$suite->run($result);

foreach ($this->extensions as $extension) {
Expand Down

0 comments on commit 10da552

Please sign in to comment.