CologneBlue rewrite: rewrite bottomLinks()
[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 MediaWikiTestCase {
10 private $lang;
11
12 protected function setUp() {
13 $this->lang = Language::factory( 'Tr' );
14 }
15 protected function tearDown() {
16 unset( $this->lang );
17 }
18
19 /**
20 * See @bug 28040
21 * Credits to irc://irc.freenode.net/wikipedia-tr users:
22 * - berm
23 * - []LuCkY[]
24 * - Emperyan
25 * @see http://en.wikipedia.org/wiki/Dotted_and_dotless_I
26 * @dataProvider provideDottedAndDotlessI
27 */
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 );
33 } else {
34 throw new MWException( __METHOD__ . " given an invalid function name '$func'" );
35 }
36
37 $msg = "Converting $inputCase case '$input' with $func should give '$expected'";
38
39 $this->assertEquals( $expected, $res, $msg );
40 }
41
42 function provideDottedAndDotlessI() {
43 return array(
44 # function, input, input case, expected
45 # Case changed:
46 array( 'ucfirst', 'ı', 'lower', 'I' ),
47 array( 'ucfirst', 'i', 'lower', 'İ' ),
48 array( 'lcfirst', 'I', 'upper', 'ı' ),
49 array( 'lcfirst', 'İ', 'upper', 'i' ),
50
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' ),
56
57 # A real example taken from bug 28040 using
58 # http://tr.wikipedia.org/wiki/%C4%B0Phone
59 array( 'lcfirst', 'iPhone', 'lower', 'iPhone' ),
60
61 # next case is valid in Turkish but are different words if we
62 # consider IPhone is English!
63 array( 'lcfirst', 'IPhone', 'upper', 'ıPhone' ),
64
65 );
66 }
67
68 }