StubIntlTest.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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(0, 'U_ZERO_ERROR'),
  21. array(1, 'U_ILLEGAL_ARGUMENT_ERROR'),
  22. array(9, 'U_PARSE_ERROR'),
  23. );
  24. }
  25. /**
  26. * @dataProvider codeProvider
  27. */
  28. public function testGetErrorName($code, $name)
  29. {
  30. $this->assertSame($name, StubIntl::getErrorName($code));
  31. }
  32. /**
  33. * @dataProvider codeProvider
  34. */
  35. public function testGetErrorNameWithIntl($code, $name)
  36. {
  37. $this->skipIfIntlExtensionIsNotLoaded();
  38. $this->assertSame(intl_error_name($code), StubIntl::getErrorName($code));
  39. }
  40. }