Merge "SI standards for time units"
[lhc/web/wiklou.git] / tests / phpunit / languages / LanguageTest.php
index 95d8fde..d8ec2e9 100644 (file)
@@ -7,10 +7,10 @@ class LanguageTest extends MediaWikiTestCase {
         */
        private $lang;
 
-       function setUp() {
+       protected function setUp() {
                $this->lang = Language::factory( 'en' );
        }
-       function tearDown() {
+       protected function tearDown() {
                unset( $this->lang );
        }
 
@@ -1065,5 +1065,30 @@ class LanguageTest extends MediaWikiTestCase {
                        array( 10000, 'MMMMMMMMMM' ),
                );
        }
+
+       /**
+        * @dataProvider providePluralData
+        */
+       function testConvertPlural( $expected, $number, $forms ) {
+               $chosen = $this->lang->convertPlural( $number, $forms );
+               $this->assertEquals( $expected, $chosen );
+       }
+
+       function providePluralData() {
+               return array(
+                       array( 'explicit zero', 0, array(
+                               '0=explicit zero', 'singular', 'plural'
+                       ) ),
+                       array( 'explicit one', 1, array(
+                               'singular', 'plural', '1=explicit one',
+                       ) ),
+                       array( 'singular', 1, array(
+                               'singular', 'plural', '0=explicit zero',
+                       ) ),
+                       array( 'plural', 3, array(
+                               '0=explicit zero', '1=explicit one', 'singular', 'plural'
+                       ) ),
+               );
+       }
 }