File tree 6 files changed +39
-175
lines changed
src/Symfony/Bridge/PhpUnit
6 files changed +39
-175
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,24 @@ class CommandForV5 extends \PHPUnit_TextUI_Command
23
23
*/
24
24
protected function createRunner ()
25
25
{
26
- return new TestRunnerForV5 ($ this ->arguments ['loader ' ]);
26
+ $ listener = new SymfonyTestsListenerForV5 ();
27
+
28
+ $ this ->arguments ['listeners ' ] = isset ($ this ->arguments ['listeners ' ]) ? $ this ->arguments ['listeners ' ] : array ();
29
+
30
+ $ registeredLocally = false ;
31
+
32
+ foreach ($ this ->arguments ['listeners ' ] as $ registeredListener ) {
33
+ if ($ registeredListener instanceof SymfonyTestsListenerForV5) {
34
+ $ registeredListener ->globalListenerDisabled ();
35
+ $ registeredLocally = true ;
36
+ break ;
37
+ }
38
+ }
39
+
40
+ if (!$ registeredLocally ) {
41
+ $ this ->arguments ['listeners ' ][] = $ listener ;
42
+ }
43
+
44
+ return parent ::createRunner ();
27
45
}
28
46
}
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 Symfony \Bridge \PhpUnit \TextUI \ TestRunner ;
16
+ use Symfony \Bridge \PhpUnit \SymfonyTestsListener ;
17
17
18
18
/**
19
19
* {@inheritdoc}
@@ -27,6 +27,24 @@ class CommandForV6 extends BaseCommand
27
27
*/
28
28
protected function createRunner (): BaseRunner
29
29
{
30
- return new TestRunner ($ this ->arguments ['loader ' ]);
30
+ $ listener = new SymfonyTestsListener ();
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 (!$ registeredLocally ) {
45
+ $ this ->arguments ['listeners ' ][] = $ listener ;
46
+ }
47
+
48
+ return parent ::createRunner ();
31
49
}
32
50
}
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments