minor #31285 [Intl] Add tests (ro0NL)
This PR was merged into the 4.3-dev branch.
Discussion
----------
[Intl] Add tests
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | no
| Tests pass? | yes (including intl-data group)
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
<!--
Write a short README entry for your feature/bugfix here (replace this comment block.)
This will help people understand your PR and can be used as a start of the Doc PR.
Additionally:
- Bug fixes must be submitted against the lowest branch where they apply
(lowest branches are regularly merged to upper ones so they get the fixes too).
- Features and deprecations must be submitted against the master branch.
-->
Commits
-------
95f09fd802
[Intl] Add tests
This commit is contained in:
commit
a7d12eeb82
@ -772,6 +772,20 @@ class CurrenciesTest extends ResourceBundleTestCase
|
||||
Currencies::forNumericCode($currency);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Intl\Exception\MissingResourceException
|
||||
*/
|
||||
public function testGetNameWithInvalidCurrencyCode()
|
||||
{
|
||||
Currencies::getName('foo');
|
||||
}
|
||||
|
||||
public function testExists()
|
||||
{
|
||||
$this->assertTrue(Currencies::exists('EUR'));
|
||||
$this->assertFalse(Currencies::exists('XXX'));
|
||||
}
|
||||
|
||||
private function getNumericToAlpha3Mapping()
|
||||
{
|
||||
$numericToAlpha3 = [];
|
||||
|
@ -915,4 +915,18 @@ class LanguagesTest extends ResourceBundleTestCase
|
||||
{
|
||||
Languages::getAlpha3Code($language);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Intl\Exception\MissingResourceException
|
||||
*/
|
||||
public function testGetNameWithInvalidLanguageCode()
|
||||
{
|
||||
Languages::getName('foo');
|
||||
}
|
||||
|
||||
public function testExists()
|
||||
{
|
||||
$this->assertTrue(Languages::exists('nl'));
|
||||
$this->assertFalse(Languages::exists('zxx'));
|
||||
}
|
||||
}
|
||||
|
@ -84,4 +84,18 @@ class LocalesTest extends ResourceBundleTestCase
|
||||
$this->assertSame($name, Locales::getName($locale));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Intl\Exception\MissingResourceException
|
||||
*/
|
||||
public function testGetNameWithInvalidLocale()
|
||||
{
|
||||
Locales::getName('foo');
|
||||
}
|
||||
|
||||
public function testExists()
|
||||
{
|
||||
$this->assertTrue(Locales::exists('nl_NL'));
|
||||
$this->assertFalse(Locales::exists('zxx_ZZ'));
|
||||
}
|
||||
}
|
||||
|
@ -343,4 +343,18 @@ class RegionsTest extends ResourceBundleTestCase
|
||||
$this->assertSame($countryNameZhTw, $countryNameHantZhTw, 'zh_TW is an alias to zh_Hant_TW');
|
||||
$this->assertNotSame($countryNameZh, $countryNameZhTw, 'zh_TW does not fall back to zh');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Intl\Exception\MissingResourceException
|
||||
*/
|
||||
public function testGetNameWithInvalidRegionCode()
|
||||
{
|
||||
Regions::getName('foo');
|
||||
}
|
||||
|
||||
public function testExists()
|
||||
{
|
||||
$this->assertTrue(Regions::exists('NL'));
|
||||
$this->assertFalse(Regions::exists('ZZ'));
|
||||
}
|
||||
}
|
||||
|
@ -274,4 +274,18 @@ class ScriptsTest extends ResourceBundleTestCase
|
||||
$this->assertSame($name, Scripts::getName($script));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Intl\Exception\MissingResourceException
|
||||
*/
|
||||
public function testGetNameWithInvalidScriptCode()
|
||||
{
|
||||
Scripts::getName('foo');
|
||||
}
|
||||
|
||||
public function testExists()
|
||||
{
|
||||
$this->assertTrue(Scripts::exists('Hans'));
|
||||
$this->assertTrue(Scripts::exists('Zzzz'));
|
||||
}
|
||||
}
|
||||
|
@ -515,4 +515,18 @@ class TimezonesTest extends ResourceBundleTestCase
|
||||
$this->assertSame($name, Timezones::getName($language));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Intl\Exception\MissingResourceException
|
||||
*/
|
||||
public function testGetNameWithInvalidTimezoneId()
|
||||
{
|
||||
Timezones::getName('foo');
|
||||
}
|
||||
|
||||
public function testExists()
|
||||
{
|
||||
$this->assertTrue(Timezones::exists('Europe/Amsterdam'));
|
||||
$this->assertFalse(Timezones::exists('Etc/Unknown'));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user