MediaWiki REL1_32
LanguageTrTest.php
Go to the documentation of this file.
1<?php
12
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}
Helping class to run tests using a clean language instance.
static provideDottedAndDotlessI()
testDottedAndDotlessI( $func, $input, $inputCase, $expected)
See T30040 Credits to irc://irc.freenode.net/wikipedia-tr users:
MediaWiki exception.
$res
Definition database.txt:21
if(is_array($mode)) switch( $mode) $input