8000 Try to move logic from runner to command · symfony/symfony@349ac1e · GitHub
[go: up one dir, main page]

Skip to content

Commit 349ac1e

Browse files
Try to move logic from runner to command
1 parent 2ca14a6 commit 349ac1e

File tree

4 files changed

+20
-112
lines changed

4 files changed

+20
-112
lines changed

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

Lines 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($arguments['listeners']) ? $this->arguments['listeners'] : array();
33+
34+
$registeredLocally = false;
35+
36+
foreach ($this->arguments['listeners'] as $registeredListener) {
37+
if ($registeredListener instanceof SymfonyTestsListener) {
38+
$registeredListener->globalListenerDisabled();
39+
10000 $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/TestRunnerForV6.php

Lines changed: 0 additions & 49 deletions
This file was deleted.

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

Lines changed: 0 additions & 49 deletions
This file was deleted.

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

Lines 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