Skip to content

Commit

Permalink
Sort warnings before printing
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Jan 14, 2023
1 parent 5c71771 commit 2e6ec91
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/TextUI/TestRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use function mt_srand;
use function range;
use function realpath;
use function sort;
use function sprintf;
use function time;
use PHPUnit\Framework\Exception;
Expand Down Expand Up @@ -571,7 +572,10 @@ public function run(TestSuite $suite, array $arguments = [], array $warnings = [
$warnings[] = 'Directives printerClass and testdox are mutually exclusive';
}

foreach (array_merge($warnings, $suite->warnings()) as $warning) {
$warnings = array_merge($warnings, $suite->warnings());
sort($warnings);

foreach ($warnings as $warning) {
$this->writeMessage('Warning', $warning);
}

Expand Down
4 changes: 2 additions & 2 deletions tests/end-to-end/generic/two-classes-per-file-invalid.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ PHPUnit\TextUI\Command::main();
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.

Warning: Multiple test case classes per file is deprecated
in %sTwoClassesInvalidTest.php
Warning: Test case class not matching filename is deprecated
in %sTwoClassesInvalidTest.php
Class name was 'TwoClassesInvalid', expected 'TwoClassesInvalidTest'
Warning: Test case class not matching filename is deprecated
in %sTwoClassesInvalidTest.php
Class name was 'TwoClassesInvalid2', expected 'TwoClassesInvalidTest'
Warning: Multiple test case classes per file is deprecated
in %sTwoClassesInvalidTest.php

.. 2 / 2 (100%)

Expand Down

0 comments on commit 2e6ec91

Please sign in to comment.