MediaWiki  master
LanguageArTest.php
Go to the documentation of this file.
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         }
00048         function testPlural( $result, $value ) {
00049                 $forms =  array( 'zero', 'one', 'two', 'few', 'many', 'other' );
00050                 $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
00051         }
00052         function providePlural() {
00053                 return array (
00054                         array( 'zero', 0 ),
00055                         array( 'one', 1 ),
00056                         array( 'two', 2 ),
00057                         array( 'few', 3 ),
00058                         array( 'few', 9 ),
00059                         array( 'few', 110 ),
00060                         array( 'many', 11 ),
00061                         array( 'many', 15 ),
00062                         array( 'many', 99 ),
00063                         array( 'many', 9999 ),
00064                         array( 'other', 100 ),
00065                         array( 'other', 102 ),
00066                         array( 'other', 1000 ),
00067                         array( 'other', 1.7 ),
00068                 );
00069         }
00070 }