MediaWiki  REL1_22
LanguageRuTest.php
Go to the documentation of this file.
00001 <?php
00010 class LanguageRuTest extends LanguageClassesTestCase {
00015     public function testPlural( $result, $value ) {
00016         $forms = array( 'one', 'many', 'other' );
00017         $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
00018     }
00019 
00024     public function testExplicitPlural() {
00025         $forms = array( 'one','many', 'other', '12=dozen' );
00026         $this->assertEquals( 'dozen', $this->getLang()->convertPlural( 12, $forms ) );
00027         $forms = array( 'one', 'many', '100=hundred', 'other', '12=dozen' );
00028         $this->assertEquals( 'hundred', $this->getLang()->convertPlural( 100, $forms ) );
00029     }
00030 
00035     public function testGetPluralRuleType( $result, $value ) {
00036         $this->assertEquals( $result, $this->getLang()->getPluralRuleType( $value ) );
00037     }
00038 
00039     public static function providePlural() {
00040         return array(
00041             array( 'one', 1 ),
00042             array( 'many', 11 ),
00043             array( 'one', 91 ),
00044             array( 'one', 121 ),
00045             array( 'other', 2 ),
00046             array( 'other', 3 ),
00047             array( 'other', 4 ),
00048             array( 'other', 334 ),
00049             array( 'many', 5 ),
00050             array( 'many', 15 ),
00051             array( 'many', 120 ),
00052         );
00053     }
00054 
00059     public function testPluralTwoForms( $result, $value ) {
00060         $forms = array( '1=one', 'other' );
00061         $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
00062     }
00063 
00064     public static function providePluralTwoForms() {
00065         return array(
00066             array( 'one', 1 ),
00067             array( 'other', 11 ),
00068             array( 'other', 91 ),
00069             array( 'other', 121 ),
00070         );
00071     }
00072 
00077     public function testGrammar( $result, $word, $case ) {
00078         $this->assertEquals( $result, $this->getLang()->convertGrammar( $word, $case ) );
00079     }
00080 
00081     public static function providerGrammar() {
00082         return array(
00083             array(
00084                 'Википедии',
00085                 'Википедия',
00086                 'genitive',
00087             ),
00088             array(
00089                 'Викитеки',
00090                 'Викитека',
00091                 'genitive',
00092             ),
00093             array(
00094                 'Викитеке',
00095                 'Викитека',
00096                 'prepositional',
00097             ),
00098             array(
00099                 'Викиданных',
00100                 'Викиданные',
00101                 'prepositional',
00102             ),
00103         );
00104     }
00105 }