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 f91c40a

Browse filesBrowse files
committed
bug #44473 [Validator] Restore default locale in ConstraintValidatorTestCase (rodnaph)
This PR was merged into the 4.4 branch. Discussion ---------- [Validator] Restore default locale in ConstraintValidatorTestCase | Q | A | ------------- | --- | Branch? | 6.1 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | N/A | License | MIT | Doc PR | N/A Previously this code was not resetting the locale after changing it to `en` - which affected other tests which relied on this value being the configured value (however it was configured). This mirrors the pattern used for the timezone, storing it to be reset on tearDown. I've based this on 6.1. If it's valid, I'm unsure if it's classed a bug, or needs UPGRADE notes? Commits ------- 77267c0 restore the overriden locale on tearDown - avoid interfering with any configured value
2 parents aaa18df + 77267c0 commit f91c40a
Copy full SHA for f91c40a

File tree

1 file changed

+4
-0
lines changed
Filter options

1 file changed

+4
-0
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ abstract class ConstraintValidatorTestCase extends TestCase
5858
protected $propertyPath;
5959
protected $constraint;
6060
protected $defaultTimezone;
61+
private $defaultLocale;
6162

6263
private function doSetUp()
6364
{
@@ -76,6 +77,7 @@ private function doSetUp()
7677
$this->validator = $this->createValidator();
7778
$this->validator->initialize($this->context);
7879

80+
$this->defaultLocale = \Locale::getDefault();
7981
\Locale::setDefault('en');
8082

8183
$this->setDefaultTimezone('UTC');
@@ -84,6 +86,8 @@ private function doSetUp()
8486
private function doTearDown()
8587
{
8688
$this->restoreDefaultTimezone();
89+
90+
\Locale::setDefault($this->defaultLocale);
8791
}
8892

8993
protected function setDefaultTimezone($defaultTimezone)

0 commit comments

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