Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitf91c40a

Browse 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/APreviously 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 parentsaaa18df +77267c0 commitf91c40a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

Lines 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
privatefunctiondoSetUp()
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
privatefunctiondoTearDown()
8587
{
8688
$this->restoreDefaultTimezone();
89+
90+
\Locale::setDefault($this->defaultLocale);
8791
}
8892

8993
protectedfunctionsetDefaultTimezone($defaultTimezone)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp