3 * @author Antoine Musso
4 * @copyright Copyright © 2011, Antoine Musso
8 /** Tests for MediaWiki languages/LanguageTr.php */
9 class LanguageTrTest
extends LanguageClassesTestCase
{
13 * Credits to irc://irc.freenode.net/wikipedia-tr users:
17 * @see http://en.wikipedia.org/wiki/Dotted_and_dotless_I
18 * @dataProvider provideDottedAndDotlessI
20 function testDottedAndDotlessI( $func, $input, $inputCase, $expected ) {
21 if ( $func == 'ucfirst' ) {
22 $res = $this->getLang()->ucfirst( $input );
23 } elseif ( $func == 'lcfirst' ) {
24 $res = $this->getLang()->lcfirst( $input );
26 throw new MWException( __METHOD__
. " given an invalid function name '$func'" );
29 $msg = "Converting $inputCase case '$input' with $func should give '$expected'";
31 $this->assertEquals( $expected, $res, $msg );
34 public static function provideDottedAndDotlessI() {
36 # function, input, input case, expected
38 array( 'ucfirst', 'ı', 'lower', 'I' ),
39 array( 'ucfirst', 'i', 'lower', 'İ' ),
40 array( 'lcfirst', 'I', 'upper', 'ı' ),
41 array( 'lcfirst', 'İ', 'upper', 'i' ),
43 # Already using the correct case
44 array( 'ucfirst', 'I', 'upper', 'I' ),
45 array( 'ucfirst', 'İ', 'upper', 'İ' ),
46 array( 'lcfirst', 'ı', 'lower', 'ı' ),
47 array( 'lcfirst', 'i', 'lower', 'i' ),
49 # A real example taken from bug 28040 using
50 # http://tr.wikipedia.org/wiki/%C4%B0Phone
51 array( 'lcfirst', 'iPhone', 'lower', 'iPhone' ),
53 # next case is valid in Turkish but are different words if we
54 # consider IPhone is English!
55 array( 'lcfirst', 'IPhone', 'upper', 'ıPhone' ),