Merge "Fix API output formatting (change lines delimited with * as bold)"
[lhc/web/wiklou.git] / tests / phpunit / languages / LanguageHeTest.php
index 6205320..6de88e5 100644 (file)
@@ -6,24 +6,16 @@
  */
 
 /** Tests for MediaWiki languages/classes/LanguageHe.php */
-class LanguageHeTest extends MediaWikiTestCase {
-       private $lang;
-
-       protected function setUp() {
-               $this->lang = Language::factory( 'he' );
-       }
-       protected function tearDown() {
-               unset( $this->lang );
-       }
+class LanguageHeTest extends LanguageClassesTestCase {
 
        /** @dataProvider providerPluralDual */
        function testPluralDual( $result, $value ) {
                $forms = array( 'one', 'two', 'other' );
-               $this->assertEquals( $result, $this->lang->convertPlural( $value, $forms ) );
+               $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
        }
 
        function providerPluralDual() {
-               return array (
+               return array(
                        array( 'other', 0 ), // Zero -> plural
                        array( 'one', 1 ), // Singular
                        array( 'two', 2 ), // Dual
@@ -34,15 +26,52 @@ class LanguageHeTest extends MediaWikiTestCase {
        /** @dataProvider providerPlural */
        function testPlural( $result, $value ) {
                $forms = array( 'one', 'other' );
-               $this->assertEquals( $result, $this->lang->convertPlural( $value, $forms ) );
+               $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
        }
 
        function providerPlural() {
-               return array (
+               return array(
                        array( 'other', 0 ), // Zero -> plural
                        array( 'one', 1 ), // Singular
                        array( 'other', 2 ), // Plural, no dual provided
                        array( 'other', 3 ), // Plural
                );
        }
+
+       /** @dataProvider providerGrammar */
+       function testGrammar( $result, $word, $case ) {
+               $this->assertEquals( $result, $this->getLang()->convertGrammar( $word, $case ) );
+       }
+
+       // The comments in the beginning of the line help avoid RTL problems
+       // with text editors.
+       function providerGrammar() {
+               return array(
+                       array(
+                               /* result */ 'וויקיפדיה',
+                               /* word   */ 'ויקיפדיה',
+                               /* case   */ 'תחילית',
+                       ),
+                       array(
+                               /* result */ 'וולפגנג',
+                               /* word   */ 'וולפגנג',
+                               /* case   */ 'prefixed',
+                       ),
+                       array(
+                               /* result */ 'קובץ',
+                               /* word   */ 'הקובץ',
+                               /* case   */ 'תחילית',
+                       ),
+                       array(
+                               /* result */ '־Wikipedia',
+                               /* word   */ 'Wikipedia',
+                               /* case   */ 'תחילית',
+                       ),
+                       array(
+                               /* result */ '־1995',
+                               /* word   */ '1995',
+                               /* case   */ 'תחילית',
+                       ),
+               );
+       }
 }