Add @covers tags to languages tests
[lhc/web/wiklou.git] / tests / phpunit / languages / classes / LanguageTrTest.php
1 <?php
2 /**
3 * @author Antoine Musso
4 * @copyright Copyright © 2011, Antoine Musso
5 * @file
6 */
7
8 /**
9 * @covers LanguageTr
10 */
11 class LanguageTrTest extends LanguageClassesTestCase {
12
13 /**
14 * See T30040
15 * Credits to irc://irc.freenode.net/wikipedia-tr users:
16 * - berm
17 * - []LuCkY[]
18 * - Emperyan
19 * @see https://en.wikipedia.org/wiki/Dotted_and_dotless_I
20 * @dataProvider provideDottedAndDotlessI
21 * @covers Language::ucfirst
22 * @covers Language::lcfirst
23 */
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 );
29 } else {
30 throw new MWException( __METHOD__ . " given an invalid function name '$func'" );
31 }
32
33 $msg = "Converting $inputCase case '$input' with $func should give '$expected'";
34
35 $this->assertEquals( $expected, $res, $msg );
36 }
37
38 public static function provideDottedAndDotlessI() {
39 return [
40 # function, input, input case, expected
41 # Case changed:
42 [ 'ucfirst', 'ı', 'lower', 'I' ],
43 [ 'ucfirst', 'i', 'lower', 'İ' ],
44 [ 'lcfirst', 'I', 'upper', 'ı' ],
45 [ 'lcfirst', 'İ', 'upper', 'i' ],
46
47 # Already using the correct case
48 [ 'ucfirst', 'I', 'upper', 'I' ],
49 [ 'ucfirst', 'İ', 'upper', 'İ' ],
50 [ 'lcfirst', 'ı', 'lower', 'ı' ],
51 [ 'lcfirst', 'i', 'lower', 'i' ],
52
53 # A real example taken from T30040 using
54 # https://tr.wikipedia.org/wiki/%C4%B0Phone
55 [ 'lcfirst', 'iPhone', 'lower', 'iPhone' ],
56
57 # next case is valid in Turkish but are different words if we
58 # consider IPhone is English!
59 [ 'lcfirst', 'IPhone', 'upper', 'ıPhone' ],
60
61 ];
62 }
63 }