LanguageGdTest.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * @author Santhosh Thottingal
  4. * @copyright Copyright © 2012-2013, Santhosh Thottingal
  5. * @file
  6. */
  7. /** Tests for MediaWiki languages/classes/LanguageGd.php */
  8. class LanguageGdTest extends LanguageClassesTestCase {
  9. /**
  10. * @dataProvider providerPlural
  11. * @covers Language::convertPlural
  12. */
  13. public function testPlural( $result, $value ) {
  14. $forms = [ 'one', 'two', 'few', 'other' ];
  15. $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
  16. }
  17. public static function providerPlural() {
  18. return [
  19. [ 'other', 0 ],
  20. [ 'one', 1 ],
  21. [ 'two', 2 ],
  22. [ 'one', 11 ],
  23. [ 'two', 12 ],
  24. [ 'few', 3 ],
  25. [ 'few', 19 ],
  26. [ 'other', 200 ],
  27. ];
  28. }
  29. /**
  30. * @dataProvider providerPluralExplicit
  31. * @covers Language::convertPlural
  32. */
  33. public function testExplicitPlural( $result, $value ) {
  34. $forms = [ 'one', 'two', 'few', 'other', '11=Form11', '12=Form12' ];
  35. $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
  36. }
  37. public static function providerPluralExplicit() {
  38. return [
  39. [ 'other', 0 ],
  40. [ 'one', 1 ],
  41. [ 'two', 2 ],
  42. [ 'Form11', 11 ],
  43. [ 'Form12', 12 ],
  44. [ 'few', 3 ],
  45. [ 'few', 19 ],
  46. [ 'other', 200 ],
  47. ];
  48. }
  49. }