Skip to content

Commit 78e6eac

Browse files
minor #61393 Fix tests (nicolas-grekas)
This PR was merged into the 7.4 branch. Discussion ---------- Fix tests | Q | A | ------------- | --- | Branch? | 7.4 | Bug fix? | no | New feature? | | Deprecations? | no | Issues | - | License | MIT Commits ------- 1aae37a Fix tests
2 parents a074042 + 1aae37a commit 78e6eac

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

src/Symfony/Bridge/Twig/Tests/Extension/AbstractLayoutTestCase.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ protected function getExtensions(): array
5858

5959
protected function tearDown(): void
6060
{
61-
\Locale::setDefault($this->defaultLocale);
61+
if (isset($this->defaultLocale)) {
62+
\Locale::setDefault($this->defaultLocale);
63+
}
6264
}
6365

6466
protected function assertWidgetMatchesXpath(FormView $view, array $vars, $xpath)

src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ private function convertParameters(array $parameters, string $type, string $keyA
403403

404404
private function encode(string $value, int $flags = \ENT_COMPAT): string
405405
{
406-
return htmlspecialchars($value, \ENT_XML1 | \ENT_SUBSTITUTE | $flags, 'UTF-8');
406+
return str_replace("\r", '
', htmlspecialchars($value, \ENT_XML1 | \ENT_SUBSTITUTE | $flags, 'UTF-8'));
407407
}
408408

409409
private function escape(array $arguments): array

src/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ public function testCrossCheck($fixture, $type)
5151

5252
unlink($tmp);
5353

54-
$this->assertEquals($container2->getAliases(), $container1->getAliases(), 'loading a dump from a previously loaded container returns the same container');
55-
$this->assertEquals($container2->getDefinitions(), $container1->getDefinitions(), 'loading a dump from a previously loaded container returns the same container');
56-
$this->assertEquals($container2->getParameterBag()->all(), $container1->getParameterBag()->all(), '->getParameterBag() returns the same value for both containers');
57-
$this->assertEquals(serialize($container2), serialize($container1), 'loading a dump from a previously loaded container returns the same container');
54+
$this->assertEquals($container1->getAliases(), $container2->getAliases(), 'loading a dump from a previously loaded container returns the same container');
55+
$this->assertEquals($container1->getDefinitions(), $container2->getDefinitions(), 'loading a dump from a previously loaded container returns the same container');
56+
$this->assertEquals($container1->getParameterBag()->all(), $container2->getParameterBag()->all(), '->getParameterBag() returns the same value for both containers');
57+
$this->assertEquals(serialize($container1), serialize($container2), 'loading a dump from a previously loaded container returns the same container');
5858

5959
$services1 = [];
6060
foreach ($container1 as $id => $service) {
@@ -67,7 +67,7 @@ public function testCrossCheck($fixture, $type)
6767

6868
unset($services1['service_container'], $services2['service_container']);
6969

70-
$this->assertEquals($services2, $services1, 'Iterator on the containers returns the same services');
70+
$this->assertEquals($services1, $services2, 'Iterator on the containers returns the same services');
7171
}
7272

7373
public static function crossCheckLoadersDumpers()

src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ protected function tearDown(): void
9797
{
9898
$this->restoreDefaultTimezone();
9999

100-
if (class_exists(\Locale::class)) {
100+
if (class_exists(\Locale::class) && isset($this->defaultLocale)) {
101101
\Locale::setDefault($this->defaultLocale);
102102
}
103103
}

0 commit comments

Comments
 (0)