StubLocaleTest.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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\Locale\Tests\Stub;
  11. use Symfony\Component\Intl\Util\IntlTestHelper;
  12. use Symfony\Component\Locale\Stub\StubLocale;
  13. /**
  14. * @author Bernhard Schussek <bschussek@gmail.com>
  15. */
  16. class StubLocaleTest extends \PHPUnit_Framework_TestCase
  17. {
  18. protected function setUp()
  19. {
  20. IntlTestHelper::requireIntl($this);
  21. parent::setUp();
  22. }
  23. public function testGetCurrenciesData()
  24. {
  25. $currencies = StubLocale::getCurrenciesData('en');
  26. $this->assertEquals('R$', $currencies['BRL']['symbol']);
  27. $this->assertEquals('Brazilian Real', $currencies['BRL']['name']);
  28. $this->assertEquals(2, $currencies['BRL']['fractionDigits']);
  29. $this->assertEquals(0, $currencies['BRL']['roundingIncrement']);
  30. }
  31. public function testGetDisplayCurrencies()
  32. {
  33. $currencies = StubLocale::getDisplayCurrencies('en');
  34. $this->assertEquals('Brazilian Real', $currencies['BRL']);
  35. // Checking that the cache is being used
  36. $currencies = StubLocale::getDisplayCurrencies('en');
  37. $this->assertEquals('Argentine Peso', $currencies['ARS']);
  38. }
  39. public function testGetCurrencies()
  40. {
  41. $currencies = StubLocale::getCurrencies();
  42. $this->assertTrue(in_array('BRL', $currencies));
  43. }
  44. }