8000 [Intl] Add tests by ro0NL · Pull Request #31285 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Intl] Add tests #31285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
8000
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[Intl] Add tests
  • Loading branch information
ro0NL committed Apr 27, 2019
commit 95f09fd80233110fe17ad51b8491a844819a1278
14 changes: 14 additions & 0 deletions src/Symfony/Component/Intl/Tests/CurrenciesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,20 @@ public function testForNumericCodeFailsIfInvalidNumericCode($currency)
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 = [];
Expand Down
14 changes: 14 additions & 0 deletions src/Symfony/Component/Intl/Tests/LanguagesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -915,4 +915,18 @@ public function testGetAlpha3CodeFailsIfNoAlpha3Equivalent($language)
{
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'));
}
}
14 changes: 14 additions & 0 deletions src/Symfony/Component/Intl/Tests/LocalesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,18 @@ public function testGetNameDefaultLocale()
$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'));
}
}
14 changes: 14 additions & 0 deletions src/Symfony/Component/Intl/Tests/RegionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -343,4 +343,18 @@ public function testLocaleAliasesAreLoaded()
$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'));
}
}
14 changes: 14 additions & 0 deletions src/Symfony/Component/Intl/Tests/ScriptsTest.php
8000
Original file line number Diff line number Diff line change
Expand Up @@ -274,4 +274,18 @@ public function testGetNameDefaultLocale()
$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'));
}
}
14 changes: 14 additions & 0 deletions src/Symfony/Component/Intl/Tests/TimezonesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -515,4 +515,18 @@ public function testGetNameDefaultLocale()
$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'));
}
}
0