Merge "(bug 17602) fix Monobook action tabs not quite touching the page body"
[lhc/web/wiklou.git] / tests / phpunit / languages / LanguageTrTest.php
1 <?php
2 /**
3 * @author Antoine Musso
4 * @copyright Copyright © 2011, Antoine Musso
5 * @file
6 */
7
8 /** Tests for MediaWiki languages/LanguageTr.php */
9 class LanguageTrTest extends LanguageClassesTestCase {
10
11 /**
12 * See @bug 28040
13 * Credits to irc://irc.freenode.net/wikipedia-tr users:
14 * - berm
15 * - []LuCkY[]
16 * - Emperyan
17 * @see http://en.wikipedia.org/wiki/Dotted_and_dotless_I
18 * @dataProvider provideDottedAndDotlessI
19 */
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 );
25 } else {
26 throw new MWException( __METHOD__ . " given an invalid function name '$func'" );
27 }
28
29 $msg = "Converting $inputCase case '$input' with $func should give '$expected'";
30
31 $this->assertEquals( $expected, $res, $msg );
32 }
33
34 public static function provideDottedAndDotlessI() {
35 return array(
36 # function, input, input case, expected
37 # Case changed:
38 array( 'ucfirst', 'ı', 'lower', 'I' ),
39 array( 'ucfirst', 'i', 'lower', 'İ' ),
40 array( 'lcfirst', 'I', 'upper', 'ı' ),
41 array( 'lcfirst', 'İ', 'upper', 'i' ),
42
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' ),
48
49 # A real example taken from bug 28040 using
50 # http://tr.wikipedia.org/wiki/%C4%B0Phone
51 array( 'lcfirst', 'iPhone', 'lower', 'iPhone' ),
52
53 # next case is valid in Turkish but are different words if we
54 # consider IPhone is English!
55 array( 'lcfirst', 'IPhone', 'upper', 'ıPhone' ),
56
57 );
58 }
59 }