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 ec41d76

Browse filesBrowse 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
Copy full SHA for ec41d76

13 files changed

+138
-208
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/Component/Console/Tests/ApplicationTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Tests/ApplicationTest.php
+8-8Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php
+1-1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Tests/Style/SymfonyStyleTest.php
+1-1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Tests/TerminalTest.php
+6-6Lines 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');

‎src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php
+7-4Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,8 @@ protected function instantiateObject(array &$data, $class, array &$context, \Ref
385385

386386
return $object;
387387
}
388+
// clean up even if no match
389+
unset($context[static::OBJECT_TO_POPULATE]);
388390

389391
$constructor = $this->getConstructor($data, $class, $context, $reflectionClass, $allowedAttributes);
390392
if ($constructor) {
@@ -453,7 +455,7 @@ protected function denormalizeParameter(\ReflectionClass $class, \ReflectionPara
453455
throw new LogicException(sprintf('Cannot create an instance of %s from serialized data because the serializer inject in "%s" is not a denormalizer', $parameter->getClass(), self::class));
454456
}
455457
$parameterClass = $parameter->getClass()->getName();
456-
$parameterData = $this->serializer->denormalize($parameterData, $parameterClass, $format, $this->createChildContext($context, $parameterName));
458+
$parameterData = $this->serializer->denormalize($parameterData, $parameterClass, $format, $this->createChildContext($context, $parameterName, $format));
457459
}
458460
} catch (\ReflectionException $e) {
459461
throw new RuntimeException(sprintf('Could not determine the class of the parameter "%s".', $parameterName), 0, $e);
@@ -468,14 +470,15 @@ protected function denormalizeParameter(\ReflectionClass $class, \ReflectionPara
468470
}
469471

470472
/**
471-
* @param array $parentContext
472-
* @param string $attribute
473+
* @param array $parentContext
474+
* @param string $attribute Attribute name
475+
* @param string|null $format
473476
*
474477
* @return array
475478
*
476479
* @internal
477480
*/
478-
protected function createChildContext(array $parentContext, $attribute)
481+
protected function createChildContext(array $parentContext, $attribute/*, string $format = null */)
479482
{
480483
if (isset($parentContext[self::ATTRIBUTES][$attribute])) {
481484
$parentContext[self::ATTRIBUTES] = $parentContext[self::ATTRIBUTES][$attribute];

0 commit comments

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