Skip to content

Commit 249c5d6

Browse files
Merge branch '4.4'
* 4.4: [HttpClient] Fix a bug preventing Server Pushes to be handled properly [HttpClient] fix support for 103 Early Hints and other informational status codes fix typo [DI] fix failure [Validator] Add ConstraintValidator::formatValue() tests [HttpClient] improve handling of HTTP/2 PUSH Fix #33427 lint all templates from configured Twig paths if no argument was provided Nullable message id? [Validator] Only handle numeric values in DivisibleBy [Validator] Sync string to date behavior and throw a better exception Check phpunit configuration for listeners registering basic exception handler for late failures [DI] fix support for "!tagged_locator foo" [Mailer] Add a more precise exception [ErrorHandler][Bridge/PhpUnit] display deprecations for not-autoloaded classes
2 parents 34dd6d3 + 2dcdd11 commit 249c5d6

File tree

4 files changed

+34
-7
lines changed

4 files changed

+34
-7
lines changed

DeprecationErrorHandler.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use PHPUnit\Util\ErrorHandler;
1616
use Symfony\Bridge\PhpUnit\DeprecationErrorHandler\Configuration;
1717
use Symfony\Bridge\PhpUnit\DeprecationErrorHandler\Deprecation;
18+
use Symfony\Component\ErrorHandler\DebugClassLoader;
1819

1920
/**
2021
* Catch deprecation notices and print a summary report at the end of the test suite.
@@ -173,6 +174,9 @@ public function shutdown()
173174
return;
174175
}
175176

177+
if (method_exists(DebugClassLoader::class, 'checkClasses')) {
178+
DebugClassLoader::checkClasses();
179+
}
176180
$currErrorHandler = set_error_handler('var_dump');
177181
restore_error_handler();
178182

Legacy/CommandForV5.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ class CommandForV5 extends \PHPUnit_TextUI_Command
2323
*/
2424
protected function createRunner()
2525
{
26-
$listener = new SymfonyTestsListenerForV5();
27-
2826
$this->arguments['listeners'] = isset($this->arguments['listeners']) ? $this->arguments['listeners'] : array();
2927

3028
$registeredLocally = false;
@@ -37,8 +35,21 @@ protected function createRunner()
3735
}
3836
}
3937

38+
if (isset($this->arguments['configuration'])) {
39+
$configuration = $this->arguments['configuration'];
40+
if (!$configuration instanceof \PHPUnit_Util_Configuration) {
41+
$configuration = \PHPUnit_Util_Configuration::getInstance($this->arguments['configuration']);
42+
}
43+
foreach ($configuration->getListenerConfiguration() as $registeredListener) {
44+
if ('Symfony\Bridge\PhpUnit\SymfonyTestsListener' === ltrim($registeredListener['class'], '\\')) {
45+
$registeredLocally = true;
46+
break;
47+
}
48+
}
49+
}
50+
4051
if (!$registeredLocally) {
41-
$this->arguments['listeners'][] = $listener;
52+
$this->arguments['listeners'][] = new SymfonyTestsListenerForV5();
4253
}
4354

4455
return parent::createRunner();

Legacy/CommandForV6.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use PHPUnit\TextUI\Command as BaseCommand;
1515
use PHPUnit\TextUI\TestRunner as BaseRunner;
16+
use PHPUnit\Util\Configuration;
1617
use Symfony\Bridge\PhpUnit\SymfonyTestsListener;
1718

1819
/**
@@ -27,8 +28,6 @@ class CommandForV6 extends BaseCommand
2728
*/
2829
protected function createRunner(): BaseRunner
2930
{
30-
$listener = new SymfonyTestsListener();
31-
3231
$this->arguments['listeners'] = isset($this->arguments['listeners']) ? $this->arguments['listeners'] : [];
3332

3433
$registeredLocally = false;
@@ -41,8 +40,21 @@ protected function createRunner(): BaseRunner
4140
}
4241
}
4342

43+
if (isset($this->arguments['configuration'])) {
44+
$configuration = $this->arguments['configuration'];
45+
if (!$configuration instanceof Configuration) {
46+
$configuration = Configuration::getInstance($this->arguments['configuration']);
47+
}
48+
foreach ($configuration->getListenerConfiguration() as $registeredListener) {
49+
if ('Symfony\Bridge\PhpUnit\SymfonyTestsListener' === ltrim($registeredListener['class'], '\\')) {
50+
$registeredLocally = true;
51+
break;
52+
}
53+
}
54+
}
55+
4456
if (!$registeredLocally) {
45-
$this->arguments['listeners'][] = $listener;
57+
$this->arguments['listeners'][] = new SymfonyTestsListener();
4658
}
4759

4860
return parent::createRunner();

bin/simple-phpunit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111

1212
// Please update when phpunit needs to be reinstalled with fresh deps:
13-
// Cache-Id: 2019-08-09 13:00 UTC
13+
// Cache-Id: 2019-09-02 16:00 UTC
1414

1515
error_reporting(-1);
1616

0 commit comments

Comments
 (0)