Merge "Add RL targets support to OutputPage"
[lhc/web/wiklou.git] / tests / phpunit / languages / LanguageRuTest.php
index f545a13..bfd5074 100644 (file)
@@ -8,15 +8,19 @@
 
 /** Tests for MediaWiki languages/classes/LanguageRu.php */
 class LanguageRuTest extends LanguageClassesTestCase {
-
-       /** @dataProvider providePluralFourForms */
-       function testPluralFourForms( $result, $value ) {
+       /** @dataProvider providePlural */
+       function testPlural( $result, $value ) {
                $forms = array( 'one', 'few', 'many', 'other' );
                $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
        }
 
-       function providePluralFourForms() {
-               return array (
+       /** @dataProvider providePlural */
+       function testGetPluralRuleType( $result, $value ) {
+               $this->assertEquals( $result, $this->getLang()->getPluralRuleType( $value ) );
+       }
+
+       public static function providePlural() {
+               return array(
                        array( 'one', 1 ),
                        array( 'many', 11 ),
                        array( 'one', 91 ),
@@ -30,17 +34,49 @@ class LanguageRuTest extends LanguageClassesTestCase {
                        array( 'many', 120 ),
                );
        }
+
        /** @dataProvider providePluralTwoForms */
        function testPluralTwoForms( $result, $value ) {
-               $forms =  array( 'one', 'several' );
+               $forms = array( 'one', 'other' );
                $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
        }
-       function providePluralTwoForms() {
-               return array (
+
+       public static function providePluralTwoForms() {
+               return array(
                        array( 'one', 1 ),
-                       array( 'several', 11 ),
-                       array( 'several', 91 ),
-                       array( 'several', 121 ),
+                       array( 'other', 11 ),
+                       array( 'other', 91 ),
+                       array( 'other', 121 ),
+               );
+       }
+
+       /** @dataProvider providerGrammar */
+       function testGrammar( $result, $word, $case ) {
+               $this->assertEquals( $result, $this->getLang()->convertGrammar( $word, $case ) );
+       }
+
+       public static function providerGrammar() {
+               return array(
+                       array(
+                               'Википедии',
+                               'Википедия',
+                               'genitive',
+                       ),
+                       array(
+                               'Викитеки',
+                               'Викитека',
+                               'genitive',
+                       ),
+                       array(
+                               'Викитеке',
+                               'Викитека',
+                               'prepositional',
+                       ),
+                       array(
+                               'Викиданных',
+                               'Викиданные',
+                               'prepositional',
+                       ),
                );
        }
 }