Skip to content

Commit ec41d76

Browse files
committed
Merge branch '3.4' into 4.2
* 3.4: [Serializer] Respect ignored attributes in cache key of normalizer fix resetting the COLUMN environment variable Fix TestRunner compatibility to PhpUnit 8 prevent mixup of the object to populate
2 parents 0d786d3 + 7a3060a commit ec41d76

File tree

13 files changed

+138
-208
lines changed

13 files changed

+138
-208
lines changed

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

Lines 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

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($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

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

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/TextUI/TestRunner.php

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

src/Symfony/Component/Console/Tests/ApplicationTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ protected function setUp()
4848
$this->colSize = getenv('COLUMNS');
4949
}
5050

51+
protected function tearDown()
52+
{
53+
putenv($this->colSize ? 'COLUMNS='.$this->colSize : 'COLUMNS');
54+
putenv('SHELL_VERBOSITY');
55+
unset($_ENV['SHELL_VERBOSITY']);
56+
unset($_SERVER['SHELL_VERBOSITY']);
57+
}
58+
5159
public static function setUpBeforeClass()
5260
{
5361
self::$fixturesPath = realpath(__DIR__.'/Fixtures/');
@@ -1749,14 +1757,6 @@ public function testThrowingErrorListener()
17491757
$tester = new ApplicationTester($application);
17501758
$tester->run(['command' => 'foo']);
17511759
}
1752-
1753-
protected function tearDown()
1754-
{
1755-
putenv($this->colSize ? 'COLUMNS' : 'COLUMNS='.$this->colSize);
1756-
putenv('SHELL_VERBOSITY');
1757-
unset($_ENV['SHELL_VERBOSITY']);
1758-
unset($_SERVER['SHELL_VERBOSITY']);
1759-
}
17601760
}
17611761

17621762
class CustomApplication extends Application

src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ protected function setUp()
3333

3434
protected function tearDown()
3535
{
36-
putenv($this->colSize ? 'COLUMNS' : 'COLUMNS='.$this->colSize);
36+
putenv($this->colSize ? 'COLUMNS='.$this->colSize : 'COLUMNS');
3737
}
3838

3939
public function testMultipleStart()

src/Symfony/Component/Console/Tests/Style/SymfonyStyleTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ protected function setUp()
3838

3939
protected function tearDown()
4040
{
41-
putenv($this->colSize ? 'COLUMNS' : 'COLUMNS='.$this->colSize);
41+
putenv($this->colSize ? 'COLUMNS='.$this->colSize : 'COLUMNS');
4242
$this->command = null;
4343
$this->tester = null;
4444
}

src/Symfony/Component/Console/Tests/TerminalTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ protected function setUp()
2525
$this->lineSize = getenv('LINES');
2626
}
2727

28+
protected function tearDown()
29+
{
30+
putenv($this->colSize ? 'COLUMNS='.$this->colSize : 'COLUMNS');
31+
putenv($this->lineSize ? 'LINES' : 'LINES='.$this->lineSize);
32+
}
33+
2834
public function test()
2935
{
3036
putenv('COLUMNS=100');
@@ -40,12 +46,6 @@ public function test()
4046
$this->assertSame(60, $terminal->getHeight());
4147
}
4248

43-
protected function tearDown()
44-
{
45-
putenv($this->colSize ? 'COLUMNS' : 'COLUMNS='.$this->colSize);
46-
putenv($this->lineSize ? 'LINES' : 'LINES='.$this->lineSize);
47-
}
48-
4949
public function test_zero_values()
5050
{
5151
putenv('COLUMNS=0');

0 commit comments

Comments
 (0)