StubIntlTest.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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\Stub;
  11. require_once __DIR__.'/../TestCase.php';
  12. use Symfony\Component\Locale\Locale;
  13. use Symfony\Component\Locale\Stub\StubIntl;
  14. use Symfony\Tests\Component\Locale\TestCase as LocaleTestCase;
  15. class StubIntlTest extends LocaleTestCase
  16. {
  17. public function codeProvider()
  18. {
  19. return array (
  20. array(-129, '[BOGUS UErrorCode]'),
  21. array(0, 'U_ZERO_ERROR'),
  22. array(1, 'U_ILLEGAL_ARGUMENT_ERROR'),
  23. array(9, 'U_PARSE_ERROR'),
  24. array(129, '[BOGUS UErrorCode]'),
  25. );
  26. }
  27. /**
  28. * @dataProvider codeProvider
  29. */
  30. public function testGetErrorName($code, $name)
  31. {
  32. $this->assertSame($name, StubIntl::getErrorName($code));
  33. }
  34. /**
  35. * @dataProvider codeProvider
  36. */
  37. public function testGetErrorNameWithIntl($code, $name)
  38. {
  39. $this->skipIfIntlExtensionIsNotLoaded();
  40. $this->assertSame(intl_error_name($code), StubIntl::getErrorName($code));
  41. }
  42. }