[Intl] Add tests
This commit is contained in:
parent
77f642ef39
commit
95f09fd802
@ -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