2017-05-29 16:22:33 +00:00
|
|
|
|
<?php
|
2017-12-25 03:10:14 +00:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @covers CollationFa
|
|
|
|
|
|
*/
|
2017-05-29 16:22:33 +00:00
|
|
|
|
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
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
2017-09-16 20:30:18 +00:00
|
|
|
|
public function setUp() {
|
|
|
|
|
|
parent::setUp();
|
2017-12-25 03:13:51 +00:00
|
|
|
|
$this->checkPHPExtension( 'intl' );
|
2017-09-16 20:30:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-05-29 16:22:33 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* @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" ],
|
|
|
|
|
|
];
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|