IcuIntegrationTest.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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\Component\Icu\Tests;
  11. use Symfony\Component\Icu\IcuCurrencyBundle;
  12. use Symfony\Component\Icu\IcuLanguageBundle;
  13. use Symfony\Component\Icu\IcuLocaleBundle;
  14. use Symfony\Component\Icu\IcuRegionBundle;
  15. use Symfony\Component\Intl\ResourceBundle\Reader\BinaryBundleReader;
  16. use Symfony\Component\Intl\ResourceBundle\Reader\StructuredBundleReader;
  17. /**
  18. * Verifies that the binary data files can actually be read.
  19. *
  20. * @author Bernhard Schussek <bschussek@gmail.com>
  21. */
  22. class IcuIntegrationTest extends IcuTestCase
  23. {
  24. public function testCurrencyBundle()
  25. {
  26. $bundle = new IcuCurrencyBundle(new StructuredBundleReader(new BinaryBundleReader()));
  27. $this->assertSame('€', $bundle->getCurrencySymbol('EUR'));
  28. }
  29. public function testLanguageBundle()
  30. {
  31. $bundle = new IcuLanguageBundle(new StructuredBundleReader(new BinaryBundleReader()));
  32. $this->assertSame('German', $bundle->getLanguageName('de', null, 'en'));
  33. }
  34. public function testLocaleBundle()
  35. {
  36. $bundle = new IcuLocaleBundle(new StructuredBundleReader(new BinaryBundleReader()));
  37. $this->assertSame('azéri', $bundle->getLocaleName('az', 'fr'));
  38. }
  39. public function testRegionBundle()
  40. {
  41. $bundle = new IcuRegionBundle(new StructuredBundleReader(new BinaryBundleReader()));
  42. $this->assertSame('Vereinigtes Königreich', $bundle->getCountryName('GB', 'de'));
  43. }
  44. }