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