Skip to content

Commit 2dcdd11

Browse files
Merge branch '4.3' into 4.4
* 4.3: [HttpClient] Fix a bug preventing Server Pushes to be handled properly [HttpClient] fix support for 103 Early Hints and other informational status codes [DI] fix failure [Validator] Add ConstraintValidator::formatValue() tests [HttpClient] improve handling of HTTP/2 PUSH Fix #33427 [Validator] Only handle numeric values in DivisibleBy [Validator] Sync string to date behavior and throw a better exception Check phpunit configuration for listeners [DI] fix support for "!tagged_locator foo"
2 parents 5741073 + b592dcb commit 2dcdd11

File tree

2 files changed

+29
-6
lines changed

2 files changed

+29
-6
lines changed

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();

0 commit comments

Comments
 (0)