1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
<?php
/**
* @covers CollationFa
*/
class CollationFaTest extends MediaWikiTestCase {
/*
* The ordering is a weird hack designed to work only with a very
* specific version of libicu, and as such can't really be unit tested
* against a random version of libicu
*/
public function setUp() {
parent::setUp();
$this->checkPHPExtension( 'intl' );
}
/**
* @dataProvider provideGetFirstLetter
*/
public function testGetFirstLetter( $letter, $str ) {
$coll = new CollationFa;
$this->assertEquals( $letter, $coll->getFirstLetter( $str ), $str );
}
public function provideGetFirstLetter() {
return [
[
'۷',
'۷'
],
[
'ا',
'ا'
],
[
'ا',
'ایران'
],
[
'ب',
'برلین'
],
[
'و',
'واو'
],
[ "\xd8\xa7", "\xd8\xa7Foo" ],
[ "\xd9\x88", "\xd9\x88Foo" ],
[ "\xd9\xb2", "\xd9\xb2Foo" ],
[ "\xd9\xb3", "\xd9\xb3Foo" ],
];
}
}
|