LanguageSeTest.php 1.2 KB

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