3 class CustomUppercaseCollationTest
extends MediaWikiTestCase
{
5 public function setUp() {
6 $this->collation
= new CustomUppercaseCollation( [
11 ], Language
::factory( 'en' ) );
17 * @dataProvider providerOrder
19 public function testOrder( $first, $second, $msg ) {
20 $sortkey1 = $this->collation
->getSortKey( $first );
21 $sortkey2 = $this->collation
->getSortKey( $second );
23 $this->assertTrue( strcmp( $sortkey1, $sortkey2 ) < 0, $msg );
26 public function providerOrder() {
28 [ 'X', 'Z', 'Maintain order of unrearranged' ],
29 [ 'D', 'C', 'Actually resorts' ],
30 [ 'D', 'B', 'resort test 2' ],
31 [ 'Adobe', 'Abode', 'not first letter' ],
32 [ '💩 ', 'C', 'Test relocated to end' ],
33 [ 'c', 'b', 'lowercase' ],
34 [ 'x', 'z', 'lowercase original' ],
35 [ 'Cz', 'Cs', 'digraphs' ],
36 [ 'C50D', 'C100', 'Numbers' ]
41 * @dataProvider provideGetFirstLetter
43 public function testGetFirstLetter( $string, $first ) {
44 $this->assertSame( $this->collation
->getFirstLetter( $string ), $first );
47 public function provideGetFirstLetter() {
53 [ "\xF3\xB3\x80\x80Foo", 'D' ],
54 [ "\xF3\xB3\x80\x81Foo", 'C' ],
55 [ "\xF3\xB3\x80\x82Foo", 'Cs' ],
56 [ "\xF3\xB3\x80\x83Foo", 'B' ],
57 [ "\xF3\xB3\x80\x84Foo", "\xF3\xB3\x80\x84" ],