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