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