Merge "Add Special:MediaStatistics page for file type stats"
[mediawiki.git] / tests / phpunit / languages / LanguageTrTest.php
blob2c9905f7b358d60d146a580a60e87aa2bf911ddc
1 <?php
2 /**
3 * @author Antoine Musso
4 * @copyright Copyright © 2011, Antoine Musso
5 * @file
6 */
8 /** Tests for MediaWiki languages/LanguageTr.php */
9 class LanguageTrTest extends LanguageClassesTestCase {
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 * @covers Language::ucfirst
20 * @covers Language::lcfirst
22 public function testDottedAndDotlessI( $func, $input, $inputCase, $expected ) {
23 if ( $func == 'ucfirst' ) {
24 $res = $this->getLang()->ucfirst( $input );
25 } elseif ( $func == 'lcfirst' ) {
26 $res = $this->getLang()->lcfirst( $input );
27 } else {
28 throw new MWException( __METHOD__ . " given an invalid function name '$func'" );
31 $msg = "Converting $inputCase case '$input' with $func should give '$expected'";
33 $this->assertEquals( $expected, $res, $msg );
36 public static function provideDottedAndDotlessI() {
37 return array(
38 # function, input, input case, expected
39 # Case changed:
40 array( 'ucfirst', 'ı', 'lower', 'I' ),
41 array( 'ucfirst', 'i', 'lower', 'İ' ),
42 array( 'lcfirst', 'I', 'upper', 'ı' ),
43 array( 'lcfirst', 'İ', 'upper', 'i' ),
45 # Already using the correct case
46 array( 'ucfirst', 'I', 'upper', 'I' ),
47 array( 'ucfirst', 'İ', 'upper', 'İ' ),
48 array( 'lcfirst', 'ı', 'lower', 'ı' ),
49 array( 'lcfirst', 'i', 'lower', 'i' ),
51 # A real example taken from bug 28040 using
52 # http://tr.wikipedia.org/wiki/%C4%B0Phone
53 array( 'lcfirst', 'iPhone', 'lower', 'iPhone' ),
55 # next case is valid in Turkish but are different words if we
56 # consider IPhone is English!
57 array( 'lcfirst', 'IPhone', 'upper', 'ıPhone' ),