LanguageSgsTest.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. /**
  3. * @author Amir E. Aharoni
  4. * @copyright Copyright © 2012, Amir E. Aharoni
  5. * @file
  6. */
  7. /** Tests for Samogitian */
  8. class LanguageSgsTest extends LanguageClassesTestCase {
  9. /**
  10. * @dataProvider providePluralAllForms
  11. * @covers Language::convertPlural
  12. */
  13. public function testPluralAllForms( $result, $value ) {
  14. $forms = [ 'one', 'two', 'few', 'other' ];
  15. $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
  16. }
  17. /**
  18. * @dataProvider providePluralAllForms
  19. * @covers Language::getPluralRuleType
  20. */
  21. public function testGetPluralRuleType( $result, $value ) {
  22. $this->assertEquals( $result, $this->getLang()->getPluralRuleType( $value ) );
  23. }
  24. public static function providePluralAllForms() {
  25. return [
  26. [ 'few', 0 ],
  27. [ 'one', 1 ],
  28. [ 'two', 2 ],
  29. [ 'other', 3 ],
  30. [ 'few', 10 ],
  31. [ 'few', 11 ],
  32. [ 'few', 12 ],
  33. [ 'few', 19 ],
  34. [ 'other', 20 ],
  35. [ 'few', 100 ],
  36. [ 'one', 101 ],
  37. [ 'few', 111 ],
  38. [ 'few', 112 ],
  39. ];
  40. }
  41. /**
  42. * @dataProvider providePluralTwoForms
  43. * @covers Language::convertPlural
  44. */
  45. public function testPluralTwoForms( $result, $value ) {
  46. $forms = [ 'one', 'other' ];
  47. $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
  48. }
  49. public static function providePluralTwoForms() {
  50. return [
  51. [ 'other', 0 ],
  52. [ 'one', 1 ],
  53. [ 'other', 2 ],
  54. [ 'other', 3 ],
  55. [ 'other', 10 ],
  56. [ 'other', 11 ],
  57. [ 'other', 12 ],
  58. [ 'other', 19 ],
  59. [ 'other', 20 ],
  60. [ 'other', 100 ],
  61. [ 'one', 101 ],
  62. [ 'other', 111 ],
  63. [ 'other', 112 ],
  64. ];
  65. }
  66. }