LocaleTest.php 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Tests\Component\Locale;
  11. require_once __DIR__.'/TestCase.php';
  12. use Symfony\Component\Locale\Locale;
  13. use Symfony\Tests\Component\Locale\TestCase as LocaleTestCase;
  14. class LocaleTest extends LocaleTestCase
  15. {
  16. public function testGetDisplayCountriesReturnsFullListForSubLocale()
  17. {
  18. $this->skipIfIntlExtensionIsNotLoaded();
  19. $countriesDe = Locale::getDisplayCountries('de');
  20. $countriesDeCh = Locale::getDisplayCountries('de_CH');
  21. $this->assertEquals(count($countriesDe), count($countriesDeCh));
  22. $this->assertEquals($countriesDe['BD'], 'Bangladesch');
  23. $this->assertEquals($countriesDeCh['BD'], 'Bangladesh');
  24. }
  25. public function testGetDisplayLanguagesReturnsFullListForSubLocale()
  26. {
  27. $this->skipIfIntlExtensionIsNotLoaded();
  28. $languagesDe = Locale::getDisplayLanguages('de');
  29. $languagesDeCh = Locale::getDisplayLanguages('de_CH');
  30. $this->assertEquals(count($languagesDe), count($languagesDeCh));
  31. $this->assertEquals($languagesDe['be'], 'Weißrussisch');
  32. $this->assertEquals($languagesDeCh['be'], 'Weissrussisch');
  33. }
  34. public function testGetDisplayLocalesReturnsFullListForSubLocale()
  35. {
  36. $this->skipIfIntlExtensionIsNotLoaded();
  37. $localesDe = Locale::getDisplayLocales('de');
  38. $localesDeCh = Locale::getDisplayLocales('de_CH');
  39. $this->assertEquals(count($localesDe), count($localesDeCh));
  40. $this->assertEquals($localesDe['be'], 'Weißrussisch');
  41. $this->assertEquals($localesDeCh['be'], 'Weissrussisch');
  42. }
  43. }