Skip to content

Commit

Permalink
Try to move logic from runner to command
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-schranz committed Apr 7, 2019
1 parent 2ca14a6 commit 343f4d4
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 112 deletions.
22 changes: 20 additions & 2 deletions src/Symfony/Bridge/PhpUnit/Legacy/CommandForV6.php
Expand Up @@ -13,7 +13,7 @@

use PHPUnit\TextUI\Command as BaseCommand;
use PHPUnit\TextUI\TestRunner as BaseRunner;
use Symfony\Bridge\PhpUnit\TextUI\TestRunner;
use Symfony\Bridge\PhpUnit\SymfonyTestsListener;

/**
* {@inheritdoc}
Expand All @@ -27,6 +27,24 @@ class CommandForV6 extends BaseCommand
*/
protected function createRunner(): BaseRunner
{
return new TestRunner($this->arguments['loader']);
$listener = new SymfonyTestsListener();

$this->arguments['listeners'] = isset($arguments['listeners']) ? $this->arguments['listeners'] : [];

$registeredLocally = false;

foreach ($this->arguments['listeners'] as $registeredListener) {
if ($registeredListener instanceof SymfonyTestsListener) {
$registeredListener->globalListenerDisabled();
$registeredLocally = true;
break;
}
}

if (!$registeredLocally) {
$this->arguments['listeners'][] = $listener;
}

return parent::createRunner();
}
}
49 changes: 0 additions & 49 deletions src/Symfony/Bridge/PhpUnit/Legacy/TestRunnerForV6.php

This file was deleted.

49 changes: 0 additions & 49 deletions src/Symfony/Bridge/PhpUnit/Legacy/TestRunnerForV7.php

This file was deleted.

12 changes: 0 additions & 12 deletions src/Symfony/Bridge/PhpUnit/bin/simple-phpunit
Expand Up @@ -100,18 +100,6 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__
if ($exit) {
exit($exit);
}
if ($PHPUNIT_VERSION >= 8.0) {
// Fix compatibility to custom TestRunner for PhpUnit 8
$testRunnerFile = 'src/TextUI/TestRunner.php';
file_put_contents(
$testRunnerFile,
str_replace(
'final class TestRunner',
'class TestRunner',
file_get_contents($testRunnerFile)
)
);
}
file_put_contents('phpunit', <<<'EOPHP'
<?php
Expand Down

0 comments on commit 343f4d4

Please sign in to comment.