NumberFormatterTest.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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\Intl\Tests\NumberFormatter\Verification;
  11. use Symfony\Component\Intl\Tests\NumberFormatter\AbstractNumberFormatterTest;
  12. use Symfony\Component\Intl\Util\IntlTestHelper;
  13. /**
  14. * Note that there are some values written like -2147483647 - 1. This is the lower 32bit int max and is a known
  15. * behavior of PHP.
  16. */
  17. class NumberFormatterTest extends AbstractNumberFormatterTest
  18. {
  19. protected function setUp()
  20. {
  21. IntlTestHelper::requireFullIntl($this, '55.1');
  22. parent::setUp();
  23. }
  24. public function testCreate()
  25. {
  26. $this->assertInstanceOf('\NumberFormatter', \NumberFormatter::create('en', \NumberFormatter::DECIMAL));
  27. }
  28. public function testGetTextAttribute()
  29. {
  30. IntlTestHelper::requireFullIntl($this, '57.1');
  31. parent::testGetTextAttribute();
  32. }
  33. protected function getNumberFormatter($locale = 'en', $style = null, $pattern = null)
  34. {
  35. return new \NumberFormatter($locale, $style, $pattern);
  36. }
  37. protected function getIntlErrorMessage()
  38. {
  39. return intl_get_error_message();
  40. }
  41. protected function getIntlErrorCode()
  42. {
  43. return intl_get_error_code();
  44. }
  45. protected function isIntlFailure($errorCode)
  46. {
  47. return intl_is_failure($errorCode);
  48. }
  49. }