MediaWiki  REL1_22
LanguageHeTest.php
Go to the documentation of this file.
00001 <?php
00009 class LanguageHeTest extends LanguageClassesTestCase {
00022     // @todo the below test*PluralForms test methods can be refactored
00023     //  to use a single test method and data provider..
00024 
00029     public function testTwoPluralForms( $result, $value ) {
00030         $forms = array( 'one', 'other' );
00031         $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
00032     }
00033 
00038     public function testThreePluralForms( $result, $value ) {
00039         $forms = array( 'one', 'two', 'other' );
00040         $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
00041     }
00042 
00047     public function testFourPluralForms( $result, $value ) {
00048         $forms = array( 'one', 'two', 'many', 'other' );
00049         $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
00050     }
00051 
00056     public function testGetPluralRuleType( $result, $value ) {
00057         $this->assertEquals( $result, $this->getLang()->getPluralRuleType( $value ) );
00058     }
00059 
00060     public static function provideTwoPluralForms() {
00061         return array(
00062             array( 'other', 0 ), // Zero - plural
00063             array( 'one', 1 ), // Singular
00064             array( 'other', 2 ), // No third form provided, use it as plural
00065             array( 'other', 3 ), // Plural - other
00066             array( 'other', 10 ), // No fourth form provided, use it as plural
00067             array( 'other', 20 ), // No fourth form provided, use it as plural
00068         );
00069     }
00070 
00071     public static function provideThreePluralForms() {
00072         return array(
00073             array( 'other', 0 ), // Zero - plural
00074             array( 'one', 1 ), // Singular
00075             array( 'two', 2 ), // Dual
00076             array( 'other', 3 ), // Plural - other
00077             array( 'other', 10 ), // No fourth form provided, use it as plural
00078             array( 'other', 20 ), // No fourth form provided, use it as plural
00079         );
00080     }
00081 
00082     public static function provideFourPluralForms() {
00083         return array(
00084             array( 'other', 0 ), // Zero - plural
00085             array( 'one', 1 ), // Singular
00086             array( 'two', 2 ), // Dual
00087             array( 'other', 3 ), // Plural - other
00088             array( 'other', 10 ), // 10 is supposed to be plural (other), not "many"
00089             array( 'many', 20 ), // Fourth form provided - rare, but supported by CLDR
00090         );
00091     }
00092 
00097     public function testGrammar( $result, $word, $case ) {
00098         $this->assertEquals( $result, $this->getLang()->convertGrammar( $word, $case ) );
00099     }
00100 
00101     // The comments in the beginning of the line help avoid RTL problems
00102     // with text editors.
00103     public static function provideGrammar() {
00104         return array(
00105             array(
00106                 /* result */'וויקיפדיה',
00107                 /* word   */'ויקיפדיה',
00108                 /* case   */'תחילית',
00109             ),
00110             array(
00111                 /* result */'וולפגנג',
00112                 /* word   */'וולפגנג',
00113                 /* case   */'prefixed',
00114             ),
00115             array(
00116                 /* result */'קובץ',
00117                 /* word   */'הקובץ',
00118                 /* case   */'תחילית',
00119             ),
00120             array(
00121                 /* result */'־Wikipedia',
00122                 /* word   */'Wikipedia',
00123                 /* case   */'תחילית',
00124             ),
00125             array(
00126                 /* result */'־1995',
00127                 /* word   */'1995',
00128                 /* case   */'תחילית',
00129             ),
00130         );
00131     }
00132 }