wiki.techinc.nl/tests/phpunit/includes/collation/CollationFaTest.php
Huji Lee f05821e87c Do not run CollationFaTest if 'intl' is not loaded
Bug: T176040
Change-Id: I6b19bf1123d4dca5a1c8e002c0de65bab2138180
2017-09-16 16:30:18 -04:00

53 lines
993 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
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();
if ( !extension_loaded( 'intl' ) ) {
$this->markTestSkipped( "PHP extension 'intl' is not loaded, skipping." );
}
}
/**
* @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" ],
];
}
}