3 * @author Antoine Musso
4 * @copyright Copyright © 2011, Antoine Musso
11 class LanguageTrTest
extends LanguageClassesTestCase
{
15 * Credits to irc://irc.freenode.net/wikipedia-tr users:
19 * @see https://en.wikipedia.org/wiki/Dotted_and_dotless_I
20 * @dataProvider provideDottedAndDotlessI
21 * @covers Language::ucfirst
22 * @covers Language::lcfirst
24 public function testDottedAndDotlessI( $func, $input, $inputCase, $expected ) {
25 if ( $func == 'ucfirst' ) {
26 $res = $this->getLang()->ucfirst( $input );
27 } elseif ( $func == 'lcfirst' ) {
28 $res = $this->getLang()->lcfirst( $input );
30 throw new MWException( __METHOD__
. " given an invalid function name '$func'" );
33 $msg = "Converting $inputCase case '$input' with $func should give '$expected'";
35 $this->assertEquals( $expected, $res, $msg );
38 public static function provideDottedAndDotlessI() {
40 # function, input, input case, expected
42 [ 'ucfirst', 'ı', 'lower', 'I' ],
43 [ 'ucfirst', 'i', 'lower', 'İ' ],
44 [ 'lcfirst', 'I', 'upper', 'ı' ],
45 [ 'lcfirst', 'İ', 'upper', 'i' ],
47 # Already using the correct case
48 [ 'ucfirst', 'I', 'upper', 'I' ],
49 [ 'ucfirst', 'İ', 'upper', 'İ' ],
50 [ 'lcfirst', 'ı', 'lower', 'ı' ],
51 [ 'lcfirst', 'i', 'lower', 'i' ],
53 # A real example taken from T30040 using
54 # https://tr.wikipedia.org/wiki/%C4%B0Phone
55 [ 'lcfirst', 'iPhone', 'lower', 'iPhone' ],
57 # next case is valid in Turkish but are different words if we
58 # consider IPhone is English!
59 [ 'lcfirst', 'IPhone', 'upper', 'ıPhone' ],