test: coverage recording now needs to be explicit
[mediawiki.git] / tests / phpunit / languages / LanguageTrTest.php
blob6358ac08b84c89e074e96006e8825450228deb98
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
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'" );
29 $msg = "Converting $inputCase case '$input' with $func should give '$expected'";
31 $this->assertEquals( $expected, $res, $msg );
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' ),
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' ),