MediaWiki
REL1_20
|
00001 <?php 00009 class LanguageTrTest extends MediaWikiTestCase { 00010 private $lang; 00011 00012 function setUp() { 00013 $this->lang = Language::factory( 'Tr' ); 00014 } 00015 function tearDown() { 00016 unset( $this->lang ); 00017 } 00018 00028 function testDottedAndDotlessI( $func, $input, $inputCase, $expected ) { 00029 if( $func == 'ucfirst' ) { 00030 $res = $this->lang->ucfirst( $input ); 00031 } elseif( $func == 'lcfirst' ) { 00032 $res = $this->lang->lcfirst( $input ); 00033 } else { 00034 throw new MWException( __METHOD__ . " given an invalid function name '$func'" ); 00035 } 00036 00037 $msg = "Converting $inputCase case '$input' with $func should give '$expected'"; 00038 00039 $this->assertEquals( $expected, $res, $msg ); 00040 } 00041 00042 function provideDottedAndDotlessI() { 00043 return array( 00044 # function, input, input case, expected 00045 # Case changed: 00046 array( 'ucfirst', 'ı', 'lower', 'I' ), 00047 array( 'ucfirst', 'i', 'lower', 'İ' ), 00048 array( 'lcfirst', 'I', 'upper', 'ı' ), 00049 array( 'lcfirst', 'İ', 'upper', 'i' ), 00050 00051 # Already using the correct case 00052 array( 'ucfirst', 'I', 'upper', 'I' ), 00053 array( 'ucfirst', 'İ', 'upper', 'İ' ), 00054 array( 'lcfirst', 'ı', 'lower', 'ı' ), 00055 array( 'lcfirst', 'i', 'lower', 'i' ), 00056 00057 # A real example taken from bug 28040 using 00058 # http://tr.wikipedia.org/wiki/%C4%B0Phone 00059 array( 'lcfirst', 'iPhone', 'lower', 'iPhone' ), 00060 00061 # next case is valid in Turkish but are different words if we 00062 # consider IPhone is English! 00063 array( 'lcfirst', 'IPhone', 'upper', 'ıPhone' ), 00064 00065 ); 00066 } 00067 00068 }