Skip to content

Commit b8fee53

Browse files
Merge branch '4.4' into 5.0
* 4.4: (25 commits) [DoctrineBridge] Use new Types::* constants and support new json type [Debug][ErrorHandler] improved deprecation notices for methods new args and return type [BrowserKit] Nested file array prevents uploading file [ExpressionLanguage] Fixed collisions of character operators with object properties [Validator] Remove specific check for Valid targets [PhpUnitBridge] Use trait instead of extending deprecated class Fix versioned namespace clears fix remember me Use strict assertion in asset tests [DoctrineBridge][DoctrineExtractor] Fix indexBy with custom and some core types Do not rely on the current locale when dumping a Graphviz object fix typo [Ldap] force default network timeout [Config] don't throw on missing excluded paths Docs: Typo, grammar [Validator] Add the missing translations for the Polish ("pl") locale [PhpUnitBridge] Add compatibility to PHPUnit 9 #35662 [Routing] Add locale requirement for localized routes [Console] Inline exact-match handling with 4.4 Set previous exception when rethrown from controller resolver ...
2 parents 1274095 + a270dbf commit b8fee53

File tree

4 files changed

+72
-4
lines changed

4 files changed

+72
-4
lines changed

Legacy/CommandForV9.php

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bridge\PhpUnit\Legacy;
13+
14+
use PHPUnit\TextUI\Command as BaseCommand;
15+
use PHPUnit\TextUI\Configuration\Configuration;
16+
use PHPUnit\TextUI\Configuration\Registry;
17+
use PHPUnit\TextUI\TestRunner as BaseRunner;
18+
use Symfony\Bridge\PhpUnit\SymfonyTestsListener;
19+
20+
/**
21+
* {@inheritdoc}
22+
*
23+
* @internal
24+
*/
25+
class CommandForV9 extends BaseCommand
26+
{
27+
/**
28+
* {@inheritdoc}
29+
*/
30+
protected function createRunner(): BaseRunner
31+
{
32+
$this->arguments['listeners'] = isset($this->arguments['listeners']) ? $this->arguments['listeners'] : [];
33+
34+
$registeredLocally = false;
35+
36+
foreach ($this->arguments['listeners'] as $registeredListener) {
37+
if ($registeredListener instanceof SymfonyTestsListener) {
38+
$registeredListener->globalListenerDisabled();
39+
$registeredLocally = true;
40+
break;
41+
}
42+
}
43+
44+
if (isset($this->arguments['configuration'])) {
45+
$configuration = $this->arguments['configuration'];
46+
if (!$configuration instanceof Configuration) {
47+
$configuration = Registry::getInstance()->get($this->arguments['configuration']);
48+
}
49+
foreach ($configuration->listeners() as $registeredListener) {
50+
if ('Symfony\Bridge\PhpUnit\SymfonyTestsListener' === ltrim($registeredListener->className(), '\\')) {
51+
$registeredLocally = true;
52+
break;
53+
}
54+
}
55+
}
56+
57+
if (!$registeredLocally) {
58+
$this->arguments['listeners'][] = new SymfonyTestsListener();
59+
}
60+
61+
return parent::createRunner();
62+
}
63+
}

Legacy/CoverageListenerForV6.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111

1212
namespace Symfony\Bridge\PhpUnit\Legacy;
1313

14-
use PHPUnit\Framework\BaseTestListener;
1514
use PHPUnit\Framework\Test;
15+
use PHPUnit\Framework\TestListener;
16+
use PHPUnit\Framework\TestListenerDefaultImplementation;
1617

1718
/**
1819
* CoverageListener adds `@covers <className>` on each test when possible to
@@ -22,8 +23,10 @@
2223
*
2324
* @internal
2425
*/
25-
class CoverageListenerForV6 extends BaseTestListener
26+
class CoverageListenerForV6 implements TestListener
2627
{
28+
use TestListenerDefaultImplementation;
29+
2730
private $trait;
2831

2932
public function __construct(callable $sutFqcnResolver = null, $warningOnSutNotFound = false)

TextUI/Command.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@
1313

1414
if (version_compare(\PHPUnit\Runner\Version::id(), '6.0.0', '<')) {
1515
class_alias('Symfony\Bridge\PhpUnit\Legacy\CommandForV5', 'Symfony\Bridge\PhpUnit\TextUI\Command');
16-
} else {
16+
} elseif (version_compare(\PHPUnit\Runner\Version::id(), '9.0.0', '<')) {
1717
class_alias('Symfony\Bridge\PhpUnit\Legacy\CommandForV6', 'Symfony\Bridge\PhpUnit\TextUI\Command');
18+
} else {
19+
class_alias('Symfony\Bridge\PhpUnit\Legacy\CommandForV9', 'Symfony\Bridge\PhpUnit\TextUI\Command');
1820
}
1921

2022
if (false) {

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"symfony/error-handler": "For tracking deprecated interfaces usages at runtime with DebugClassLoader"
2525
},
2626
"conflict": {
27-
"phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0"
27+
"phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0|<6.4,>=6.0"
2828
},
2929
"autoload": {
3030
"files": [ "bootstrap.php" ],

0 commit comments

Comments
 (0)