MediaWiki  REL1_23
LanguageTrTest.php
Go to the documentation of this file.
00001 <?php
00009 class LanguageTrTest extends LanguageClassesTestCase {
00010 
00022     public function testDottedAndDotlessI( $func, $input, $inputCase, $expected ) {
00023         if ( $func == 'ucfirst' ) {
00024             $res = $this->getLang()->ucfirst( $input );
00025         } elseif ( $func == 'lcfirst' ) {
00026             $res = $this->getLang()->lcfirst( $input );
00027         } else {
00028             throw new MWException( __METHOD__ . " given an invalid function name '$func'" );
00029         }
00030 
00031         $msg = "Converting $inputCase case '$input' with $func should give '$expected'";
00032 
00033         $this->assertEquals( $expected, $res, $msg );
00034     }
00035 
00036     public static function provideDottedAndDotlessI() {
00037         return array(
00038             # function, input, input case, expected
00039             # Case changed:
00040             array( 'ucfirst', 'ı', 'lower', 'I' ),
00041             array( 'ucfirst', 'i', 'lower', 'İ' ),
00042             array( 'lcfirst', 'I', 'upper', 'ı' ),
00043             array( 'lcfirst', 'İ', 'upper', 'i' ),
00044 
00045             # Already using the correct case
00046             array( 'ucfirst', 'I', 'upper', 'I' ),
00047             array( 'ucfirst', 'İ', 'upper', 'İ' ),
00048             array( 'lcfirst', 'ı', 'lower', 'ı' ),
00049             array( 'lcfirst', 'i', 'lower', 'i' ),
00050 
00051             # A real example taken from bug 28040 using
00052             # http://tr.wikipedia.org/wiki/%C4%B0Phone
00053             array( 'lcfirst', 'iPhone', 'lower', 'iPhone' ),
00054 
00055             # next case is valid in Turkish but are different words if we
00056             # consider IPhone is English!
00057             array( 'lcfirst', 'IPhone', 'upper', 'ıPhone' ),
00058 
00059         );
00060     }
00061 }