Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a7d12ee

Browse filesBrowse files
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 ------- 95f09fd [Intl] Add tests
2 parents 77f642e + 95f09fd commit a7d12ee
Copy full SHA for a7d12ee

File tree

6 files changed

+84
-0
lines changed
Filter options

6 files changed

+84
-0
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Intl/Tests/CurrenciesTest.php
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -772,6 +772,20 @@ public function testForNumericCodeFailsIfInvalidNumericCode($currency)
772772
Currencies::forNumericCode($currency);
773773
}
774774

775+
/**
776+
* @expectedException \Symfony\Component\Intl\Exception\MissingResourceException
777+
*/
778+
public function testGetNameWithInvalidCurrencyCode()
779+
{
780+
Currencies::getName('foo');
781+
}
782+
783+
public function testExists()
784+
{
785+
$this->assertTrue(Currencies::exists('EUR'));
786+
$this->assertFalse(Currencies::exists('XXX'));
787+
}
788+
775789
private function getNumericToAlpha3Mapping()
776790
{
777791
$numericToAlpha3 = [];

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Intl/Tests/LanguagesTest.php
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -915,4 +915,18 @@ public function testGetAlpha3CodeFailsIfNoAlpha3Equivalent($language)
915915
{
916916
Languages::getAlpha3Code($language);
917917
}
918+
919+
/**
920+
* @expectedException \Symfony\Component\Intl\Exception\MissingResourceException
921+
*/
922+
public function testGetNameWithInvalidLanguageCode()
923+
{
924+
Languages::getName('foo');
925+
}
926+
927+
public function testExists()
928+
{
929+
$this->assertTrue(Languages::exists('nl'));
930+
$this->assertFalse(Languages::exists('zxx'));
931+
}
918932
}

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Intl/Tests/LocalesTest.php
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,18 @@ public function testGetNameDefaultLocale()
8484
$this->assertSame($name, Locales::getName($locale));
8585
}
8686
}
87+
88+
/**
89+
* @expectedException \Symfony\Component\Intl\Exception\MissingResourceException
90+
*/
91+
public function testGetNameWithInvalidLocale()
92+
{
93+
Locales::getName('foo');
94+
}
95+
96+
public function testExists()
97+
{
98+
$this->assertTrue(Locales::exists('nl_NL'));
99+
$this->assertFalse(Locales::exists('zxx_ZZ'));
100+
}
87101
}

‎src/Symfony/Component/Intl/Tests/RegionsTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Intl/Tests/RegionsTest.php
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,4 +343,18 @@ public function testLocaleAliasesAreLoaded()
343343
$this->assertSame($countryNameZhTw, $countryNameHantZhTw, 'zh_TW is an alias to zh_Hant_TW');
344344
$this->assertNotSame($countryNameZh, $countryNameZhTw, 'zh_TW does not fall back to zh');
345345
}
346+
347+
/**
348+
* @expectedException \Symfony\Component\Intl\Exception\MissingResourceException
349+
*/
350+
public function testGetNameWithInvalidRegionCode()
351+
{
352+
Regions::getName('foo');
353+
}
354+
355+
public function testExists()
356+
{
357+
$this->assertTrue(Regions::exists('NL'));
358+
$this->assertFalse(Regions::exists('ZZ'));
359+
}
346360
}

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Intl/Tests/ScriptsTest.php
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,4 +274,18 @@ public function testGetNameDefaultLocale()
274274
$this->assertSame($name, Scripts::getName($script));
275275
}
276276
}
277+
278+
/**
279+
* @expectedException \Symfony\Component\Intl\Exception\MissingResourceException
280+
*/
281+
public function testGetNameWithInvalidScriptCode()
282+
{
283+
Scripts::getName('foo');
284+
}
285+
286+
public function testExists()
287+
{
288+
$this->assertTrue(Scripts::exists('Hans'));
289+
$this->assertTrue(Scripts::exists('Zzzz'));
290+
}
277291
}

‎src/Symfony/Component/Intl/Tests/TimezonesTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Intl/Tests/TimezonesTest.php
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,4 +515,18 @@ public function testGetNameDefaultLocale()
515515
$this->assertSame($name, Timezones::getName($language));
516516
}
517517
}
518+
519+
/**
520+
* @expectedException \Symfony\Component\Intl\Exception\MissingResourceException
521+
*/
522+
public function testGetNameWithInvalidTimezoneId()
523+
{
524+
Timezones::getName('foo');
525+
}
526+
527+
public function testExists()
528+
{
529+
$this->assertTrue(Timezones::exists('Europe/Amsterdam'));
530+
$this->assertFalse(Timezones::exists('Etc/Unknown'));
531+
}
518532
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.