Skip to content

Commit 4e852ff

Browse files
Merge branch '5.4' into 6.4
* 5.4: fix detecting anonymous exception classes on Windows and PHP 7 skip tests requiring the intl extension if it's not installed [RateLimiter] Fix DateInterval normalization [Security] Store original token in token storage when implicitly exiting impersonation [Cache] Fix clear() when using Predis
2 parents e9fbfa4 + d747633 commit 4e852ff

6 files changed

+122
-0
lines changed

Tests/CountriesTest.php

+23
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Component\Intl\Countries;
1515
use Symfony\Component\Intl\Exception\MissingResourceException;
16+
use Symfony\Component\Intl\Util\IntlTestHelper;
1617

1718
/**
1819
* @group intl-data
@@ -823,6 +824,10 @@ public function testGetCountryCodes()
823824
*/
824825
public function testGetNames($displayLocale)
825826
{
827+
if ('en' !== $displayLocale) {
828+
IntlTestHelper::requireFullIntl($this);
829+
}
830+
826831
$countries = array_keys(Countries::getNames($displayLocale));
827832

828833
sort($countries);
@@ -832,6 +837,8 @@ public function testGetNames($displayLocale)
832837

833838
public function testGetNamesDefaultLocale()
834839
{
840+
IntlTestHelper::requireFullIntl($this);
841+
835842
\Locale::setDefault('de_AT');
836843

837844
$this->assertSame(Countries::getNames('de_AT'), Countries::getNames());
@@ -842,6 +849,10 @@ public function testGetNamesDefaultLocale()
842849
*/
843850
public function testGetNamesSupportsAliases($alias, $ofLocale)
844851
{
852+
if ('en' !== $ofLocale) {
853+
IntlTestHelper::requireFullIntl($this);
854+
}
855+
845856
// Can't use assertSame(), because some aliases contain scripts with
846857
// different collation (=order of output) than their aliased locale
847858
// e.g. sr_Latn_ME => sr_ME
@@ -853,6 +864,10 @@ public function testGetNamesSupportsAliases($alias, $ofLocale)
853864
*/
854865
public function testGetName($displayLocale)
855866
{
867+
if ('en' !== $displayLocale) {
868+
IntlTestHelper::requireFullIntl($this);
869+
}
870+
856871
$names = Countries::getNames($displayLocale);
857872

858873
foreach ($names as $country => $name) {
@@ -924,6 +939,10 @@ public function testAlpha3CodeExists()
924939
*/
925940
public function testGetAlpha3Name($displayLocale)
926941
{
942+
if ('en' !== $displayLocale) {
943+
IntlTestHelper::requireFullIntl($this);
944+
}
945+
927946
$names = Countries::getNames($displayLocale);
928947

929948
foreach ($names as $alpha2 => $name) {
@@ -944,6 +963,10 @@ public function testGetAlpha3NameWithInvalidCountryCode()
944963
*/
945964
public function testGetAlpha3Names($displayLocale)
946965
{
966+
if ('en' !== $displayLocale) {
967+
IntlTestHelper::requireFullIntl($this);
968+
}
969+
947970
$names = Countries::getAlpha3Names($displayLocale);
948971

949972
$alpha3Codes = array_keys($names);

Tests/CurrenciesTest.php

+17
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Component\Intl\Currencies;
1515
use Symfony\Component\Intl\Exception\MissingResourceException;
16+
use Symfony\Component\Intl\Util\IntlTestHelper;
1617

1718
/**
1819
* @group intl-data
@@ -600,6 +601,10 @@ public function testGetCurrencyCodes()
600601
*/
601602
public function testGetNames($displayLocale)
602603
{
604+
if ('en' !== $displayLocale) {
605+
IntlTestHelper::requireFullIntl($this);
606+
}
607+
603608
$names = Currencies::getNames($displayLocale);
604609

605610
$keys = array_keys($names);
@@ -618,6 +623,8 @@ public function testGetNames($displayLocale)
618623

619624
public function testGetNamesDefaultLocale()
620625
{
626+
IntlTestHelper::requireFullIntl($this);
627+
621628
\Locale::setDefault('de_AT');
622629

623630
$this->assertSame(Currencies::getNames('de_AT'), Currencies::getNames());
@@ -628,6 +635,10 @@ public function testGetNamesDefaultLocale()
628635
*/
629636
public function testGetNamesSupportsAliases($alias, $ofLocale)
630637
{
638+
if ('en' !== $ofLocale) {
639+
IntlTestHelper::requireFullIntl($this);
640+
}
641+
631642
// Can't use assertSame(), because some aliases contain scripts with
632643
// different collation (=order of output) than their aliased locale
633644
// e.g. sr_Latn_ME => sr_ME
@@ -639,6 +650,10 @@ public function testGetNamesSupportsAliases($alias, $ofLocale)
639650
*/
640651
public function testGetName($displayLocale)
641652
{
653+
if ('en' !== $displayLocale) {
654+
IntlTestHelper::requireFullIntl($this);
655+
}
656+
642657
$expected = Currencies::getNames($displayLocale);
643658
$actual = [];
644659

@@ -651,6 +666,8 @@ public function testGetName($displayLocale)
651666

652667
public function testGetNameDefaultLocale()
653668
{
669+
IntlTestHelper::requireFullIntl($this);
670+
654671
\Locale::setDefault('de_AT');
655672

656673
$expected = Currencies::getNames('de_AT');

Tests/LanguagesTest.php

+25
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Component\Intl\Exception\MissingResourceException;
1515
use Symfony\Component\Intl\Languages;
16+
use Symfony\Component\Intl\Util\IntlTestHelper;
1617

1718
/**
1819
* @group intl-data
@@ -1713,6 +1714,10 @@ public function testGetLanguageCodes()
17131714
*/
17141715
public function testGetNames($displayLocale)
17151716
{
1717+
if ('en' !== $displayLocale) {
1718+
IntlTestHelper::requireFullIntl($this);
1719+
}
1720+
17161721
$languages = array_keys($names = Languages::getNames($displayLocale));
17171722

17181723
sort($languages);
@@ -1730,6 +1735,8 @@ public function testGetNames($displayLocale)
17301735

17311736
public function testGetNamesDefaultLocale()
17321737
{
1738+
IntlTestHelper::requireFullIntl($this);
1739+
17331740
\Locale::setDefault('de_AT');
17341741

17351742
$this->assertSame(Languages::getNames('de_AT'), Languages::getNames());
@@ -1740,6 +1747,10 @@ public function testGetNamesDefaultLocale()
17401747
*/
17411748
public function testGetNamesSupportsAliases($alias, $ofLocale)
17421749
{
1750+
if ('en' !== $ofLocale) {
1751+
IntlTestHelper::requireFullIntl($this);
1752+
}
1753+
17431754
// Can't use assertSame(), because some aliases contain scripts with
17441755
// different collation (=order of output) than their aliased locale
17451756
// e.g. sr_Latn_ME => sr_ME
@@ -1751,6 +1762,10 @@ public function testGetNamesSupportsAliases($alias, $ofLocale)
17511762
*/
17521763
public function testGetName($displayLocale)
17531764
{
1765+
if ('en' !== $displayLocale) {
1766+
IntlTestHelper::requireFullIntl($this);
1767+
}
1768+
17541769
$names = Languages::getNames($displayLocale);
17551770

17561771
foreach ($names as $language => $name) {
@@ -1767,6 +1782,8 @@ public function testLocalizedGetName()
17671782

17681783
public function testGetNameDefaultLocale()
17691784
{
1785+
IntlTestHelper::requireFullIntl($this);
1786+
17701787
\Locale::setDefault('de_AT');
17711788

17721789
$names = Languages::getNames('de_AT');
@@ -1877,6 +1894,10 @@ public function testAlpha3CodeExists()
18771894
*/
18781895
public function testGetAlpha3Name($displayLocale)
18791896
{
1897+
if ('en' !== $displayLocale) {
1898+
IntlTestHelper::requireFullIntl($this);
1899+
}
1900+
18801901
$names = Languages::getAlpha3Names($displayLocale);
18811902

18821903
foreach ($names as $language => $name) {
@@ -1896,6 +1917,10 @@ public function testGetAlpha3NameWithInvalidLanguageCode()
18961917
*/
18971918
public function testGetAlpha3Names($displayLocale)
18981919
{
1920+
if ('en' !== $displayLocale) {
1921+
IntlTestHelper::requireFullIntl($this);
1922+
}
1923+
18991924
$languages = array_keys($names = Languages::getAlpha3Names($displayLocale));
19001925

19011926
sort($languages);

Tests/LocalesTest.php

+17
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Component\Intl\Exception\MissingResourceException;
1515
use Symfony\Component\Intl\Locales;
16+
use Symfony\Component\Intl\Util\IntlTestHelper;
1617

1718
/**
1819
* @group intl-data
@@ -34,6 +35,10 @@ public function testGetAliases()
3435
*/
3536
public function testGetNames($displayLocale)
3637
{
38+
if ('en' !== $displayLocale) {
39+
IntlTestHelper::requireFullIntl($this);
40+
}
41+
3742
$locales = array_keys(Locales::getNames($displayLocale));
3843

3944
sort($locales);
@@ -46,6 +51,8 @@ public function testGetNames($displayLocale)
4651

4752
public function testGetNamesDefaultLocale()
4853
{
54+
IntlTestHelper::requireFullIntl($this);
55+
4956
\Locale::setDefault('de_AT');
5057

5158
$this->assertSame(Locales::getNames('de_AT'), Locales::getNames());
@@ -56,6 +63,10 @@ public function testGetNamesDefaultLocale()
5663
*/
5764
public function testGetNamesSupportsAliases($alias, $ofLocale)
5865
{
66+
if ('en' !== $ofLocale) {
67+
IntlTestHelper::requireFullIntl($this);
68+
}
69+
5970
// Can't use assertSame(), because some aliases contain scripts with
6071
// different collation (=order of output) than their aliased locale
6172
// e.g. sr_Latn_ME => sr_ME
@@ -67,6 +78,10 @@ public function testGetNamesSupportsAliases($alias, $ofLocale)
6778
*/
6879
public function testGetName($displayLocale)
6980
{
81+
if ('en' !== $displayLocale) {
82+
IntlTestHelper::requireFullIntl($this);
83+
}
84+
7085
$names = Locales::getNames($displayLocale);
7186

7287
foreach ($names as $locale => $name) {
@@ -76,6 +91,8 @@ public function testGetName($displayLocale)
7691

7792
public function testGetNameDefaultLocale()
7893
{
94+
IntlTestHelper::requireFullIntl($this);
95+
7996
\Locale::setDefault('de_AT');
8097

8198
$names = Locales::getNames('de_AT');

Tests/ScriptsTest.php

+17
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Component\Intl\Exception\MissingResourceException;
1515
use Symfony\Component\Intl\Scripts;
16+
use Symfony\Component\Intl\Util\IntlTestHelper;
1617

1718
/**
1819
* @group intl-data
@@ -235,6 +236,10 @@ public function testGetScriptCodes()
235236
*/
236237
public function testGetNames($displayLocale)
237238
{
239+
if ('en' !== $displayLocale) {
240+
IntlTestHelper::requireFullIntl($this);
241+
}
242+
238243
$scripts = array_keys(Scripts::getNames($displayLocale));
239244

240245
sort($scripts);
@@ -247,6 +252,8 @@ public function testGetNames($displayLocale)
247252

248253
public function testGetNamesDefaultLocale()
249254
{
255+
IntlTestHelper::requireFullIntl($this);
256+
250257
\Locale::setDefault('de_AT');
251258

252259
$this->assertSame(Scripts::getNames('de_AT'), Scripts::getNames());
@@ -257,6 +264,10 @@ public function testGetNamesDefaultLocale()
257264
*/
258265
public function testGetNamesSupportsAliases($alias, $ofLocale)
259266
{
267+
if ('en' !== $ofLocale) {
268+
IntlTestHelper::requireFullIntl($this);
269+
}
270+
260271
// Can't use assertSame(), because some aliases contain scripts with
261272
// different collation (=order of output) than their aliased locale
262273
// e.g. sr_Latn_ME => sr_ME
@@ -268,6 +279,10 @@ public function testGetNamesSupportsAliases($alias, $ofLocale)
268279
*/
269280
public function testGetName($displayLocale)
270281
{
282+
if ('en' !== $displayLocale) {
283+
IntlTestHelper::requireFullIntl($this);
284+
}
285+
271286
$names = Scripts::getNames($displayLocale);
272287

273288
foreach ($names as $script => $name) {
@@ -277,6 +292,8 @@ public function testGetName($displayLocale)
277292

278293
public function testGetNameDefaultLocale()
279294
{
295+
IntlTestHelper::requireFullIntl($this);
296+
280297
\Locale::setDefault('de_AT');
281298

282299
$names = Scripts::getNames('de_AT');

0 commit comments

Comments
 (0)