MediaWiki
REL1_31
LanguageTrTest.php
Go to the documentation of this file.
1
<?php
11
class
LanguageTrTest
extends
LanguageClassesTestCase
{
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
}
LanguageClassesTestCase
Helping class to run tests using a clean language instance.
Definition
LanguageClassesTestCase.php:21
LanguageClassesTestCase\getLang
getLang()
Definition
LanguageClassesTestCase.php:41
LanguageTrTest
LanguageTr.
Definition
LanguageTrTest.php:11
LanguageTrTest\provideDottedAndDotlessI
static provideDottedAndDotlessI()
Definition
LanguageTrTest.php:38
LanguageTrTest\testDottedAndDotlessI
testDottedAndDotlessI( $func, $input, $inputCase, $expected)
See T30040 Credits to irc://irc.freenode.net/wikipedia-tr users:
Definition
LanguageTrTest.php:24
MWException
MediaWiki exception.
Definition
MWException.php:26
$res
$res
Definition
database.txt:21
$input
if(is_array($mode)) switch( $mode) $input
Definition
postprocess-phan.php:145
tests
phpunit
languages
classes
LanguageTrTest.php
Generated on Mon Nov 25 2024 15:36:42 for MediaWiki by
1.10.0