Skip to content

Commit

Permalink
Consistently handle test runner warnings and test suite warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Jan 14, 2023
1 parent ee28807 commit 5c71771
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 19 deletions.
14 changes: 1 addition & 13 deletions src/TextUI/TestRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ public function run(TestSuite $suite, array $arguments = [], array $warnings = [
$warnings[] = 'Directives printerClass and testdox are mutually exclusive';
}

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

Expand Down Expand Up @@ -646,18 +646,6 @@ public function run(TestSuite $suite, array $arguments = [], array $warnings = [
}
}

$testSuiteWarningsPrinted = false;

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

$testSuiteWarningsPrinted = true;
}

if ($testSuiteWarningsPrinted) {
$this->write(PHP_EOL);
}

$suite->run($result);

foreach ($this->extensions as $extension) {
Expand Down
1 change: 0 additions & 1 deletion tests/end-to-end/generic/dataprovider-issue-2922.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ PHPUnit\TextUI\Command::main();
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.


Warning: Test case class not matching filename is deprecated
in %sSecondTest.php
Class name was 'SecondHelloWorldTest', expected 'SecondTest'
Expand Down
1 change: 0 additions & 1 deletion tests/end-to-end/generic/filename-matches-class-name.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ PHPUnit\TextUI\Command::main();
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.


Warning: Test case class not matching filename is deprecated
in %sWrongClassNameTest.php
Class name was 'WrongClassNameBar', expected 'WrongClassNameTest'
Expand Down
1 change: 0 additions & 1 deletion tests/end-to-end/generic/test-suffix-multiple.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ PHPUnit\TextUI\Command::main();
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.


Warning: Test case class not matching filename is deprecated
in %sBankAccountTest.test.php
Class name was 'BankAccountWithCustomExtensionTest', expected 'BankAccountTest'
Expand Down
1 change: 0 additions & 1 deletion tests/end-to-end/generic/test-suffix-single.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ PHPUnit\TextUI\Command::main();
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.


Warning: Test case class not matching filename is deprecated
in %sBankAccountTest.test.php
Class name was 'BankAccountWithCustomExtensionTest', expected 'BankAccountTest'
Expand Down
1 change: 0 additions & 1 deletion tests/end-to-end/generic/two-classes-per-file-invalid.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ PHPUnit\TextUI\Command::main();
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.


Warning: Test case class not matching filename is deprecated
in %sTwoClassesInvalidTest.php
Class name was 'TwoClassesInvalid', expected 'TwoClassesInvalidTest'
Expand Down
1 change: 0 additions & 1 deletion tests/end-to-end/regression/2972.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ PHPUnit\TextUI\Command::main();
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.


Warning: Test case class not matching filename is deprecated
in %sunconventiallyNamedIssue2972Test.php
Class name was 'Issue2972Test', expected 'unconventiallyNamedIssue2972Test'
Expand Down

0 comments on commit 5c71771

Please sign in to comment.