File tree Expand file tree Collapse file tree 2 files changed +29
-6
lines changed Expand file tree Collapse file tree 2 files changed +29
-6
lines changed Original file line number Diff line number Diff line change @@ -23,8 +23,6 @@ class CommandForV5 extends \PHPUnit_TextUI_Command
23
23
*/
24
24
protected function createRunner ()
25
25
{
26
- $ listener = new SymfonyTestsListenerForV5 ();
27
-
28
26
$ this ->arguments ['listeners ' ] = isset ($ this ->arguments ['listeners ' ]) ? $ this ->arguments ['listeners ' ] : array ();
29
27
30
28
$ registeredLocally = false ;
@@ -37,8 +35,21 @@ protected function createRunner()
37
35
}
38
36
}
39
37
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
+
40
51
if (!$ registeredLocally ) {
41
- $ this ->arguments ['listeners ' ][] = $ listener ;
52
+ $ this ->arguments ['listeners ' ][] = new SymfonyTestsListenerForV5 () ;
42
53
}
43
54
44
55
return parent ::createRunner ();
Original file line number Diff line number Diff line change 13
13
14
14
use PHPUnit \TextUI \Command as BaseCommand ;
15
15
use PHPUnit \TextUI \TestRunner as BaseRunner ;
16
+ use PHPUnit \Util \Configuration ;
16
17
use Symfony \Bridge \PhpUnit \SymfonyTestsListener ;
17
18
18
19
/**
@@ -27,8 +28,6 @@ class CommandForV6 extends BaseCommand
27
28
*/
28
29
protected function createRunner (): BaseRunner
29
30
{
30
- $ listener = new SymfonyTestsListener ();
31
-
32
31
$ this ->arguments ['listeners ' ] = isset ($ this ->arguments ['listeners ' ]) ? $ this ->arguments ['listeners ' ] : [];
33
32
34
33
$ registeredLocally = false ;
@@ -41,8 +40,21 @@ protected function createRunner(): BaseRunner
41
40
}
42
41
}
43
42
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
+
44
56
if (!$ registeredLocally ) {
45
- $ this ->arguments ['listeners ' ][] = $ listener ;
57
+ $ this ->arguments ['listeners ' ][] = new SymfonyTestsListener () ;
46
58
}
47
59
48
60
return parent ::createRunner ();
You can’t perform that action at this time.
0 commit comments