MediaWiki
REL1_21
|
00001 <?php 00008 class LanguageArTest extends LanguageClassesTestCase { 00009 00010 function testFormatNum() { 00011 $this->assertEquals( '١٬٢٣٤٬٥٦٧', $this->getLang()->formatNum( '1234567' ) ); 00012 $this->assertEquals( '-١٢٫٨٩', $this->getLang()->formatNum( -12.89 ) ); 00013 } 00014 00019 function testSprintfDate( $format, $date, $expected ) { 00020 $this->assertEquals( $expected, $this->getLang()->sprintfDate( $format, $date ) ); 00021 } 00022 00023 function providerSprintfDate() { 00024 return array( 00025 array( 00026 'xg "vs" g', 00027 '20120102030410', 00028 'يناير vs ٣' 00029 ), 00030 array( 00031 'xmY', 00032 '20120102030410', 00033 '١٤٣٣' 00034 ), 00035 array( 00036 'xnxmY', 00037 '20120102030410', 00038 '1433' 00039 ), 00040 array( 00041 'xN xmj xmn xN xmY', 00042 '20120102030410', 00043 ' 7 2 ١٤٣٣' 00044 ), 00045 ); 00046 } 00047 00049 function testPlural( $result, $value ) { 00050 $forms = array( 'zero', 'one', 'two', 'few', 'many', 'other' ); 00051 $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) ); 00052 } 00053 00054 function providePlural() { 00055 return array( 00056 array( 'zero', 0 ), 00057 array( 'one', 1 ), 00058 array( 'two', 2 ), 00059 array( 'few', 3 ), 00060 array( 'few', 9 ), 00061 array( 'few', 110 ), 00062 array( 'many', 11 ), 00063 array( 'many', 15 ), 00064 array( 'many', 99 ), 00065 array( 'many', 9999 ), 00066 array( 'other', 100 ), 00067 array( 'other', 102 ), 00068 array( 'other', 1000 ), 00069 array( 'other', 1.7 ), 00070 ); 00071 } 00072 }