3 * @author Ashar Voultoiz
4 * @copyright Copyright © 2011, Ashar Voultoiz
8 /** Tests for MediaWiki languages/LanguageTr.php */
9 class LanguageTrTest
extends MediaWikiTestCase
{
13 $this->lang
= Language
::factory( 'Tr' );
21 * Credits to #wikipedia-tr users berm, []LuCkY[] and Emperyan
22 * @see http://en.wikipedia.org/wiki/Dotted_and_dotless_I
23 * @dataProvider provideDottedAndDotlessI
25 function testDottedAndDotlessI( $func, $input, $inputCase, $expected ) {
26 if( $func == 'ucfirst' ) {
27 $res = $this->lang
->ucfirst( $input );
28 } elseif( $func == 'lcfirst' ) {
29 $res = $this->lang
->lcfirst( $input );
31 throw new MWException( __METHOD__
. " given an invalid function name '$func'" );
34 $msg = "Converting $inputCase case '$input' with $func should give '$expected'";
36 $this->assertEquals( $expected, $res, $msg );
39 function provideDottedAndDotlessI() {
41 # function, input, input case, expected
43 array( 'ucfirst', 'ı', 'lower', 'I' ),
44 array( 'ucfirst', 'i', 'lower', 'İ' ),
45 array( 'lcfirst', 'I', 'upper', 'ı' ),
46 array( 'lcfirst', 'İ', 'upper', 'i' ),
48 # Already using the correct case
49 array( 'ucfirst', 'I', 'upper', 'I' ),
50 array( 'ucfirst', 'İ', 'upper', 'İ' ),
51 array( 'lcfirst', 'ı', 'lower', 'ı' ),
52 array( 'lcfirst', 'i', 'lower', 'i' ),
54 # A real example taken from bug 28040 using
55 # http://tr.wikipedia.org/wiki/%C4%B0Phone
56 array( 'lcfirst', 'iPhone', 'lower', 'iPhone' ),
58 # next case is valid in Turkish but are different words if we
59 # consider IPhone is English!
60 array( 'lcfirst', 'IPhone', 'upper', 'ıPhone' ),