MediaWiki
REL1_31
CustomUppercaseCollationTest.php
Go to the documentation of this file.
1
<?php
2
6
class
CustomUppercaseCollationTest
extends
MediaWikiTestCase
{
7
8
public
function
setUp
() {
9
$this->collation =
new
CustomUppercaseCollation
( [
10
'D'
,
11
'C'
,
12
'Cs'
,
13
'B'
14
], Language::factory(
'en'
) );
15
16
parent::setUp();
17
}
18
22
public
function
testOrder
( $first, $second, $msg ) {
23
$sortkey1 = $this->collation->getSortKey( $first );
24
$sortkey2 = $this->collation->getSortKey( $second );
25
26
$this->assertTrue( strcmp( $sortkey1, $sortkey2 ) < 0, $msg );
27
}
28
29
public
function
providerOrder
() {
30
return
[
31
[
'X'
,
'Z'
,
'Maintain order of unrearranged'
],
32
[
'D'
,
'C'
,
'Actually resorts'
],
33
[
'D'
,
'B'
,
'resort test 2'
],
34
[
'Adobe'
,
'Abode'
,
'not first letter'
],
35
[
'💩 '
,
'C'
,
'Test relocated to end'
],
36
[
'c'
,
'b'
,
'lowercase'
],
37
[
'x'
,
'z'
,
'lowercase original'
],
38
[
'Cz'
,
'Cs'
,
'digraphs'
],
39
[
'C50D'
,
'C100'
,
'Numbers'
]
40
];
41
}
42
46
public
function
testGetFirstLetter
( $string, $first ) {
47
$this->assertSame( $this->collation->getFirstLetter( $string ), $first );
48
}
49
50
public
function
provideGetFirstLetter
() {
51
return
[
52
[
'Do'
,
'D'
],
53
[
'do'
,
'D'
],
54
[
'Ao'
,
'A'
],
55
[
'afdsa'
,
'A'
],
56
[
"\xF3\xB3\x80\x80Foo"
,
'D'
],
57
[
"\xF3\xB3\x80\x81Foo"
,
'C'
],
58
[
"\xF3\xB3\x80\x82Foo"
,
'Cs'
],
59
[
"\xF3\xB3\x80\x83Foo"
,
'B'
],
60
[
"\xF3\xB3\x80\x84Foo"
,
"\xF3\xB3\x80\x84"
],
61
[
'C'
,
'C'
],
62
[
'Cz'
,
'C'
],
63
[
'Cs'
,
'Cs'
],
64
[
'CS'
,
'Cs'
],
65
[
'cs'
,
'Cs'
],
66
];
67
}
68
}
CustomUppercaseCollationTest
CustomUppercaseCollation.
Definition
CustomUppercaseCollationTest.php:6
CustomUppercaseCollationTest\testGetFirstLetter
testGetFirstLetter( $string, $first)
provideGetFirstLetter
Definition
CustomUppercaseCollationTest.php:46
CustomUppercaseCollationTest\providerOrder
providerOrder()
Definition
CustomUppercaseCollationTest.php:29
CustomUppercaseCollationTest\provideGetFirstLetter
provideGetFirstLetter()
Definition
CustomUppercaseCollationTest.php:50
CustomUppercaseCollationTest\setUp
setUp()
Definition
CustomUppercaseCollationTest.php:8
CustomUppercaseCollationTest\testOrder
testOrder( $first, $second, $msg)
providerOrder
Definition
CustomUppercaseCollationTest.php:22
CustomUppercaseCollation
Resort normal UTF-8 order by putting a bunch of stuff in PUA.
Definition
CustomUppercaseCollation.php:40
MediaWikiTestCase
Definition
MediaWikiTestCase.php:17
tests
phpunit
includes
collation
CustomUppercaseCollationTest.php
Generated on Mon Nov 25 2024 15:36:18 for MediaWiki by
1.10.0