8000 skip tests requiring the intl extension if it's not installed · symfony/symfony@9d3f02d · GitHub
[go: up one dir, main page]

Skip to content

Commit 9d3f02d

Browse files
committed
skip tests requiring the intl extension if it's not installed
1 parent c905bb4 commit 9d3f02d

File tree

6 files changed

+122
-0
lines changed

6 files changed

+122
-0
lines changed

src/Symfony/Component/Intl/Tests/CountriesTest.php

Lines changed: 23 additions & 0 deletions
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
@@ -535,6 +536,10 @@ public function testGetCountryCodes()
535536
*/
536537
public function testGetNames($displayLocale)
537538
{
539+
if ('en' !== $displayLocale) {
540+
IntlTestHelper::requireFullIntl($this);
541+
}
542+
538543
$countries = array_keys(Countries::getNames($displayLocale));
539544

540545
sort($countries);
@@ -544,6 +549,8 @@ public function testGetNames($displayLocale)
544549

545550
public function testGetNamesDefaultLocale()
546551
{
552+
IntlTestHelper::requireFullIntl($this);
553+
547554
\Locale::setDefault('de_AT');
548555

549556
$this->assertSame(Countries::getNames('de_AT'), Countries::getNames());
@@ -554,6 +561,10 @@ public function testGetNamesDefaultLocale()
554561
*/
555562
public function testGetNamesSupportsAliases($alias, $ofLocale)
556563
{
564+
if ('en' !== $ofLocale) {
565+
IntlTestHelper::requireFullIntl($this);
566+
}
567+
557568
// Can't use assertSame(), because some aliases contain scripts with
558569
// different collation (=order of output) than their aliased locale
559570
// e.g. sr_Latn_ME => sr_ME
@@ -565,6 +576,10 @@ public function testGetNamesSupp 8000 ortsAliases($alias, $ofLocale)
565576
*/
566577
public function testGetName($displayLocale)
567578
{
579+
if ('en' !== $displayLocale) {
580+
IntlTestHelper::requireFullIntl($this);
581+
}
582+
568583
$names = Countries::getNames($displayLocale);
569584

570585
foreach ($names as $country => $name) {
@@ -636,6 +651,10 @@ public function testAlpha3CodeExists()
636651
*/
637652
public function testGetAlpha3Name($displayLocale)
638653
{
654+
if ('en' !== $displayLocale) {
655+
IntlTestHelper::requireFullIntl($this);
656+
}
657+
639658
$names = Countries::getNames($displayLocale);
640659

641660
foreach ($names as $alpha2 => $name) {
@@ -656,6 +675,10 @@ public function testGetAlpha3NameWithInvalidCountryCode()
656675
*/
657676
public function testGetAlpha3Names($displayLocale)
658677
{
678+
if ('en' !== $displayLocale) {
679+
IntlTestHelper::requireFullIntl($this);
680+
}
681+
659682
$names = Countries::getAlpha3Names($displayLocale);
660683

661684
$alpha3Codes = array_keys($names);

src/Symfony/Component/Intl/Tests/CurrenciesTest.php

Lines changed: 17 additions & 0 deletions
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) {
F438 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');

src/Symfony/Component/Intl/Tests/LanguagesTest.php

Lines changed: 25 additions & 0 deletions
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);

src/Symfony/Component/Intl/Tests/LocalesTest.php

Lines changed: 17 additions & 0 deletions
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');

src/Symfony/Component/Intl/Tests/ScriptsTest.php

Lines changed: 17 additions & 0 deletions
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)
0