phpunit testcases on the plural rules for am, ar, be, be_tarask, bh, bs and hi languages
[lhc/web/wiklou.git] / tests / phpunit / languages / LanguageArTest.php
index 81488ad..b23e053 100644 (file)
@@ -52,4 +52,27 @@ class LanguageArTest extends MediaWikiTestCase {
                        ),
                );
        }
+       /** @dataProvider providePlural */
+       function testPlural( $result, $value ) {
+               $forms =  array( 'zero', 'one', 'two', 'few', 'many', 'other' );
+               $this->assertEquals( $result, $this->lang->convertPlural( $value, $forms ) );
+       }
+       function providePlural() {
+               return array (
+                       array( 'zero', 0 ),
+                       array( 'one', 1 ),
+                       array( 'two', 2 ),
+                       array( 'few', 3 ),
+                       array( 'few', 9 ),
+                       array( 'few', 110 ),
+                       array( 'many', 11 ),
+                       array( 'many', 15 ),
+                       array( 'many', 99 ),
+                       array( 'many', 9999 ),
+                       array( 'other', 100 ),
+                       array( 'other', 102 ),
+                       array( 'other', 1000 ),
+                       array( 'other', 1.7 ),
+               );
+       }
 }