Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3bf78a0

Browse filesBrowse files
Try to move logic from runner to command
1 parent 2ca14a6 commit 3bf78a0
Copy full SHA for 3bf78a0

File tree

7 files changed

+39
-187
lines changed
Filter options

7 files changed

+39
-187
lines changed

‎src/Symfony/Bridge/PhpUnit/Legacy/CommandForV5.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/PhpUnit/Legacy/CommandForV5.php
+19-1Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,24 @@ class CommandForV5 extends \PHPUnit_TextUI_Command
2323
*/
2424
protected function createRunner()
2525
{
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();
2745
}
2846
}

‎src/Symfony/Bridge/PhpUnit/Legacy/CommandForV6.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/PhpUnit/Legacy/CommandForV6.php
+20-2Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
use PHPUnit\TextUI\Command as BaseCommand;
1515
use PHPUnit\TextUI\TestRunner as BaseRunner;
16-
use Symfony\Bridge\PhpUnit\TextUI\TestRunner;
16+
use Symfony\Bridge\PhpUnit\SymfonyTestsListener;
1717

1818
/**
1919
* {@inheritdoc}
@@ -27,6 +27,24 @@ class CommandForV6 extends BaseCommand
2727
*/
2828
protected function createRunner(): BaseRunner
2929
{
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();
3149
}
3250
}

‎src/Symfony/Bridge/PhpUnit/Legacy/TestRunnerForV5.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/PhpUnit/Legacy/TestRunnerForV5.php
-48Lines changed: 0 additions & 48 deletions
This file was deleted.

‎src/Symfony/Bridge/PhpUnit/Legacy/TestRunnerForV6.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/PhpUnit/Legacy/TestRunnerForV6.php
-49Lines changed: 0 additions & 49 deletions
This file was deleted.

‎src/Symfony/Bridge/PhpUnit/Legacy/TestRunnerForV7.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/PhpUnit/Legacy/TestRunnerForV7.php
-49Lines changed: 0 additions & 49 deletions
This file was deleted.

‎src/Symfony/Bridge/PhpUnit/TextUI/TestRunner.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/PhpUnit/TextUI/TestRunner.php
-26Lines changed: 0 additions & 26 deletions
This file was deleted.

‎src/Symfony/Bridge/PhpUnit/bin/simple-phpunit

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/PhpUnit/bin/simple-phpunit
-12Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -100,18 +100,6 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__
100100
if ($exit) {
101101
exit($exit);
102102
}
103-
if ($PHPUNIT_VERSION >= 8.0) {
104-
// Fix compatibility to custom TestRunner for PhpUnit 8
105-
$testRunnerFile = 'src/TextUI/TestRunner.php';
106-
file_put_contents(
107-
$testRunnerFile,
108-
str_replace(
109-
'final class TestRunner',
110-
'class TestRunner',
111-
file_get_contents($testRunnerFile)
112-
)
113-
);
114-
}
115103
file_put_contents('phpunit', <<<'EOPHP'
116104
<?php
117105

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.