LanguageMlTest.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. /**
  3. * @author Santhosh Thottingal
  4. * @copyright Copyright © 2011, Santhosh Thottingal
  5. * @file
  6. */
  7. /**
  8. * @covers LanguageMl
  9. */
  10. class LanguageMlTest extends LanguageClassesTestCase {
  11. /**
  12. * @dataProvider provideFormatNum
  13. * @covers Language::formatNum
  14. */
  15. public function testFormatNum( $result, $value ) {
  16. // For T31495
  17. $this->assertEquals( $result, $this->getLang()->formatNum( $value ) );
  18. }
  19. public static function provideFormatNum() {
  20. return [
  21. [ '12,34,567', '1234567' ],
  22. [ '12,345', '12345' ],
  23. [ '1', '1' ],
  24. [ '123', '123' ],
  25. [ '1,234', '1234' ],
  26. [ '12,345.56', '12345.56' ],
  27. [ '12,34,56,79,81,23,45,678', '12345679812345678' ],
  28. [ '.12345', '.12345' ],
  29. [ '-12,00,000', '-1200000' ],
  30. [ '-98', '-98' ],
  31. [ '-98', -98 ],
  32. [ '-1,23,45,678', -12345678 ],
  33. [ '', '' ],
  34. [ '', null ],
  35. ];
  36. }
  37. /**
  38. * @covers LanguageMl::normalize
  39. * @covers Language::normalize
  40. * @dataProvider provideNormalize
  41. */
  42. public function testNormalize( $input, $expected ) {
  43. if ( $input === $expected ) {
  44. throw new Exception( 'Expected output must differ.' );
  45. }
  46. $this->setMwGlobals( 'wgFixMalayalamUnicode', true );
  47. $this->assertSame( $expected, $this->getLang()->normalize( $input ), 'ml-normalised form' );
  48. $this->setMwGlobals( 'wgFixMalayalamUnicode', false );
  49. $this->assertSame( $input, $this->getLang()->normalize( $input ), 'regular normalised form' );
  50. }
  51. public static function provideNormalize() {
  52. return [
  53. [
  54. 'ല്‍',
  55. 'ൽ',
  56. ],
  57. ];
  58. }
  59. }