Merge branch '4.4' into 5.2
* 4.4: [CI] Make sure to restore default locale
This commit is contained in:
commit
ef17a59096
@ -26,6 +26,7 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
|
||||
|
||||
protected $csrfTokenManager;
|
||||
protected $testableFeatures = [];
|
||||
private $defaultLocale;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
@ -33,6 +34,7 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
|
||||
$this->markTestSkipped('Extension intl is required.');
|
||||
}
|
||||
|
||||
$this->defaultLocale = \Locale::getDefault();
|
||||
\Locale::setDefault('en');
|
||||
|
||||
$this->csrfTokenManager = $this->createMock(CsrfTokenManagerInterface::class);
|
||||
@ -50,6 +52,7 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
|
||||
protected function tearDown(): void
|
||||
{
|
||||
$this->csrfTokenManager = null;
|
||||
\Locale::setDefault($this->defaultLocale);
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ class DateTimeToLocalizedStringTransformerTest extends TestCase
|
||||
|
||||
protected $dateTime;
|
||||
protected $dateTimeWithoutSeconds;
|
||||
private $defaultLocale;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
@ -37,6 +38,7 @@ class DateTimeToLocalizedStringTransformerTest extends TestCase
|
||||
// Since we test against "de_AT", we need the full implementation
|
||||
IntlTestHelper::requireFullIntl($this, '57.1');
|
||||
|
||||
$this->defaultLocale = \Locale::getDefault();
|
||||
\Locale::setDefault('de_AT');
|
||||
|
||||
$this->dateTime = new \DateTime('2010-02-03 04:05:06 UTC');
|
||||
@ -47,6 +49,7 @@ class DateTimeToLocalizedStringTransformerTest extends TestCase
|
||||
{
|
||||
$this->dateTime = null;
|
||||
$this->dateTimeWithoutSeconds = null;
|
||||
\Locale::setDefault($this->defaultLocale);
|
||||
}
|
||||
|
||||
public function dataProvider()
|
||||
|
@ -19,15 +19,18 @@ use Symfony\Component\Intl\Util\IntlTestHelper;
|
||||
class MoneyToLocalizedStringTransformerTest extends TestCase
|
||||
{
|
||||
private $previousLocale;
|
||||
private $defaultLocale;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->previousLocale = setlocale(\LC_ALL, '0');
|
||||
$this->defaultLocale = \Locale::getDefault();
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
setlocale(\LC_ALL, $this->previousLocale);
|
||||
\Locale::setDefault($this->defaultLocale);
|
||||
}
|
||||
|
||||
public function testTransform()
|
||||
|
@ -18,13 +18,20 @@ class DateTimeTypeTest extends BaseTypeTest
|
||||
{
|
||||
public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\DateTimeType';
|
||||
|
||||
private $defaultLocale;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->defaultLocale = \Locale::getDefault();
|
||||
\Locale::setDefault('en');
|
||||
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
\Locale::setDefault($this->defaultLocale);
|
||||
}
|
||||
|
||||
public function testSubmitDateTime()
|
||||
{
|
||||
$form = $this->factory->create(static::TESTED_TYPE, null, [
|
||||
|
@ -725,13 +725,20 @@ abstract class ResourceBundleTestCase extends TestCase
|
||||
];
|
||||
|
||||
private static $rootLocales;
|
||||
private $defaultLocale;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->defaultLocale = \Locale::getDefault();
|
||||
Locale::setDefault('en');
|
||||
Locale::setDefaultFallback('en');
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
\Locale::setDefault($this->defaultLocale);
|
||||
}
|
||||
|
||||
public function provideLocales()
|
||||
{
|
||||
return array_map(
|
||||
|
@ -30,6 +30,18 @@ use Symfony\Contracts\Translation\TranslatorTrait;
|
||||
*/
|
||||
class TranslatorTest extends TestCase
|
||||
{
|
||||
private $defaultLocale;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->defaultLocale = \Locale::getDefault();
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
\Locale::setDefault($this->defaultLocale);
|
||||
}
|
||||
|
||||
public function getTranslator()
|
||||
{
|
||||
return new class() implements TranslatorInterface {
|
||||
|
Reference in New Issue
Block a user