Skip to content

Commit

Permalink
Merge branch '6.4' into 7.1
Browse files Browse the repository at this point in the history
* 6.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
  • Loading branch information
nicolas-grekas committed Nov 5, 2024
2 parents c65630c + 4e852ff commit 4770ebd
Show file tree
Hide file tree
Showing 6 changed files with 122 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Tests/CountriesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use Symfony\Component\Intl\Countries;
use Symfony\Component\Intl\Exception\MissingResourceException;
use Symfony\Component\Intl\Util\IntlTestHelper;

/**
* @group intl-data
Expand Down Expand Up @@ -823,6 +824,10 @@ public function testGetCountryCodes()
*/
public function testGetNames($displayLocale)
{
if ('en' !== $displayLocale) {
IntlTestHelper::requireFullIntl($this);
}

$countries = array_keys(Countries::getNames($displayLocale));

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

public function testGetNamesDefaultLocale()
{
IntlTestHelper::requireFullIntl($this);

\Locale::setDefault('de_AT');

$this->assertSame(Countries::getNames('de_AT'), Countries::getNames());
Expand All @@ -842,6 +849,10 @@ public function testGetNamesDefaultLocale()
*/
public function testGetNamesSupportsAliases($alias, $ofLocale)
{
if ('en' !== $ofLocale) {
IntlTestHelper::requireFullIntl($this);
}

// Can't use assertSame(), because some aliases contain scripts with
// different collation (=order of output) than their aliased locale
// e.g. sr_Latn_ME => sr_ME
Expand All @@ -853,6 +864,10 @@ public function testGetNamesSupportsAliases($alias, $ofLocale)
*/
public function testGetName($displayLocale)
{
if ('en' !== $displayLocale) {
IntlTestHelper::requireFullIntl($this);
}

$names = Countries::getNames($displayLocale);

foreach ($names as $country => $name) {
Expand Down Expand Up @@ -924,6 +939,10 @@ public function testAlpha3CodeExists()
*/
public function testGetAlpha3Name($displayLocale)
{
if ('en' !== $displayLocale) {
IntlTestHelper::requireFullIntl($this);
}

$names = Countries::getNames($displayLocale);

foreach ($names as $alpha2 => $name) {
Expand All @@ -944,6 +963,10 @@ public function testGetAlpha3NameWithInvalidCountryCode()
*/
public function testGetAlpha3Names($displayLocale)
{
if ('en' !== $displayLocale) {
IntlTestHelper::requireFullIntl($this);
}

$names = Countries::getAlpha3Names($displayLocale);

$alpha3Codes = array_keys($names);
Expand Down
17 changes: 17 additions & 0 deletions Tests/CurrenciesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use Symfony\Component\Intl\Currencies;
use Symfony\Component\Intl\Exception\MissingResourceException;
use Symfony\Component\Intl\Util\IntlTestHelper;

/**
* @group intl-data
Expand Down Expand Up @@ -600,6 +601,10 @@ public function testGetCurrencyCodes()
*/
public function testGetNames($displayLocale)
{
if ('en' !== $displayLocale) {
IntlTestHelper::requireFullIntl($this);
}

$names = Currencies::getNames($displayLocale);

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

public function testGetNamesDefaultLocale()
{
IntlTestHelper::requireFullIntl($this);

\Locale::setDefault('de_AT');

$this->assertSame(Currencies::getNames('de_AT'), Currencies::getNames());
Expand All @@ -628,6 +635,10 @@ public function testGetNamesDefaultLocale()
*/
public function testGetNamesSupportsAliases($alias, $ofLocale)
{
if ('en' !== $ofLocale) {
IntlTestHelper::requireFullIntl($this);
}

// Can't use assertSame(), because some aliases contain scripts with
// different collation (=order of output) than their aliased locale
// e.g. sr_Latn_ME => sr_ME
Expand All @@ -639,6 +650,10 @@ public function testGetNamesSupportsAliases($alias, $ofLocale)
*/
public function testGetName($displayLocale)
{
if ('en' !== $displayLocale) {
IntlTestHelper::requireFullIntl($this);
}

$expected = Currencies::getNames($displayLocale);
$actual = [];

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

public function testGetNameDefaultLocale()
{
IntlTestHelper::requireFullIntl($this);

\Locale::setDefault('de_AT');

$expected = Currencies::getNames('de_AT');
Expand Down
25 changes: 25 additions & 0 deletions Tests/LanguagesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use Symfony\Component\Intl\Exception\MissingResourceException;
use Symfony\Component\Intl\Languages;
use Symfony\Component\Intl\Util\IntlTestHelper;

/**
* @group intl-data
Expand Down Expand Up @@ -1713,6 +1714,10 @@ public function testGetLanguageCodes()
*/
public function testGetNames($displayLocale)
{
if ('en' !== $displayLocale) {
IntlTestHelper::requireFullIntl($this);
}

$languages = array_keys($names = Languages::getNames($displayLocale));

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

public function testGetNamesDefaultLocale()
{
IntlTestHelper::requireFullIntl($this);

\Locale::setDefault('de_AT');

$this->assertSame(Languages::getNames('de_AT'), Languages::getNames());
Expand All @@ -1740,6 +1747,10 @@ public function testGetNamesDefaultLocale()
*/
public function testGetNamesSupportsAliases($alias, $ofLocale)
{
if ('en' !== $ofLocale) {
IntlTestHelper::requireFullIntl($this);
}

// Can't use assertSame(), because some aliases contain scripts with
// different collation (=order of output) than their aliased locale
// e.g. sr_Latn_ME => sr_ME
Expand All @@ -1751,6 +1762,10 @@ public function testGetNamesSupportsAliases($alias, $ofLocale)
*/
public function testGetName($displayLocale)
{
if ('en' !== $displayLocale) {
IntlTestHelper::requireFullIntl($this);
}

$names = Languages::getNames($displayLocale);

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

public function testGetNameDefaultLocale()
{
IntlTestHelper::requireFullIntl($this);

\Locale::setDefault('de_AT');

$names = Languages::getNames('de_AT');
Expand Down Expand Up @@ -1877,6 +1894,10 @@ public function testAlpha3CodeExists()
*/
public function testGetAlpha3Name($displayLocale)
{
if ('en' !== $displayLocale) {
IntlTestHelper::requireFullIntl($this);
}

$names = Languages::getAlpha3Names($displayLocale);

foreach ($names as $language => $name) {
Expand All @@ -1896,6 +1917,10 @@ public function testGetAlpha3NameWithInvalidLanguageCode()
*/
public function testGetAlpha3Names($displayLocale)
{
if ('en' !== $displayLocale) {
IntlTestHelper::requireFullIntl($this);
}

$languages = array_keys($names = Languages::getAlpha3Names($displayLocale));

sort($languages);
Expand Down
17 changes: 17 additions & 0 deletions Tests/LocalesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use Symfony\Component\Intl\Exception\MissingResourceException;
use Symfony\Component\Intl\Locales;
use Symfony\Component\Intl\Util\IntlTestHelper;

/**
* @group intl-data
Expand All @@ -34,6 +35,10 @@ public function testGetAliases()
*/
public function testGetNames($displayLocale)
{
if ('en' !== $displayLocale) {
IntlTestHelper::requireFullIntl($this);
}

$locales = array_keys(Locales::getNames($displayLocale));

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

public function testGetNamesDefaultLocale()
{
IntlTestHelper::requireFullIntl($this);

\Locale::setDefault('de_AT');

$this->assertSame(Locales::getNames('de_AT'), Locales::getNames());
Expand All @@ -56,6 +63,10 @@ public function testGetNamesDefaultLocale()
*/
public function testGetNamesSupportsAliases($alias, $ofLocale)
{
if ('en' !== $ofLocale) {
IntlTestHelper::requireFullIntl($this);
}

// Can't use assertSame(), because some aliases contain scripts with
// different collation (=order of output) than their aliased locale
// e.g. sr_Latn_ME => sr_ME
Expand All @@ -67,6 +78,10 @@ public function testGetNamesSupportsAliases($alias, $ofLocale)
*/
public function testGetName($displayLocale)
{
if ('en' !== $displayLocale) {
IntlTestHelper::requireFullIntl($this);
}

$names = Locales::getNames($displayLocale);

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

public function testGetNameDefaultLocale()
{
IntlTestHelper::requireFullIntl($this);

\Locale::setDefault('de_AT');

$names = Locales::getNames('de_AT');
Expand Down
17 changes: 17 additions & 0 deletions Tests/ScriptsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use Symfony\Component\Intl\Exception\MissingResourceException;
use Symfony\Component\Intl\Scripts;
use Symfony\Component\Intl\Util\IntlTestHelper;

/**
* @group intl-data
Expand Down Expand Up @@ -235,6 +236,10 @@ public function testGetScriptCodes()
*/
public function testGetNames($displayLocale)
{
if ('en' !== $displayLocale) {
IntlTestHelper::requireFullIntl($this);
}

$scripts = array_keys(Scripts::getNames($displayLocale));

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

public function testGetNamesDefaultLocale()
{
IntlTestHelper::requireFullIntl($this);

\Locale::setDefault('de_AT');

$this->assertSame(Scripts::getNames('de_AT'), Scripts::getNames());
Expand All @@ -257,6 +264,10 @@ public function testGetNamesDefaultLocale()
*/
public function testGetNamesSupportsAliases($alias, $ofLocale)
{
if ('en' !== $ofLocale) {
IntlTestHelper::requireFullIntl($this);
}

// Can't use assertSame(), because some aliases contain scripts with
// different collation (=order of output) than their aliased locale
// e.g. sr_Latn_ME => sr_ME
Expand All @@ -268,6 +279,10 @@ public function testGetNamesSupportsAliases($alias, $ofLocale)
*/
public function testGetName($displayLocale)
{
if ('en' !== $displayLocale) {
IntlTestHelper::requireFullIntl($this);
}

$names = Scripts::getNames($displayLocale);

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

public function testGetNameDefaultLocale()
{
IntlTestHelper::requireFullIntl($this);

\Locale::setDefault('de_AT');

$names = Scripts::getNames('de_AT');
Expand Down
Loading

0 comments on commit 4770ebd

Please sign in to comment.