MediaWiki
REL1_30
LanguageTrTest.php
Go to the documentation of this file.
1
<?php
9
class
LanguageTrTest
extends
LanguageClassesTestCase
{
10
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'"
);
29
}
30
31
$msg =
"Converting $inputCase case '$input' with $func should give '$expected'"
;
32
33
$this->assertEquals( $expected,
$res
, $msg );
34
}
35
36
public
static
function
provideDottedAndDotlessI
() {
37
return
[
38
# function, input, input case, expected
39
# Case changed:
40
[
'ucfirst'
,
'ı'
,
'lower'
,
'I'
],
41
[
'ucfirst'
,
'i'
,
'lower'
,
'İ'
],
42
[
'lcfirst'
,
'I'
,
'upper'
,
'ı'
],
43
[
'lcfirst'
,
'İ'
,
'upper'
,
'i'
],
44
45
# Already using the correct case
46
[
'ucfirst'
,
'I'
,
'upper'
,
'I'
],
47
[
'ucfirst'
,
'İ'
,
'upper'
,
'İ'
],
48
[
'lcfirst'
,
'ı'
,
'lower'
,
'ı'
],
49
[
'lcfirst'
,
'i'
,
'lower'
,
'i'
],
50
51
# A real example taken from T30040 using
52
# https:
//tr.wikipedia.org/wiki/%C4%B0Phone
53
[
'lcfirst'
,
'iPhone'
,
'lower'
,
'iPhone'
],
54
55
# next case is valid in Turkish but are different words if we
56
# consider IPhone is English!
57
[
'lcfirst'
,
'IPhone'
,
'upper'
,
'ıPhone'
],
58
59
];
60
}
61
}
LanguageClassesTestCase
Helping class to run tests using a clean language instance.
Definition
LanguageClassesTestCase.php:21
LanguageClassesTestCase\getLang
getLang()
Definition
LanguageClassesTestCase.php:41
LanguageTrTest
Tests for MediaWiki languages/LanguageTr.php.
Definition
LanguageTrTest.php:9
LanguageTrTest\provideDottedAndDotlessI
static provideDottedAndDotlessI()
Definition
LanguageTrTest.php:36
LanguageTrTest\testDottedAndDotlessI
testDottedAndDotlessI( $func, $input, $inputCase, $expected)
See T30040 Credits to irc://irc.freenode.net/wikipedia-tr users:
Definition
LanguageTrTest.php:22
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:141
tests
phpunit
languages
classes
LanguageTrTest.php
Generated on Mon Nov 25 2024 15:44:04 for MediaWiki by
1.10.0