diff options
author | Yaco <franco@reevo.org> | 2020-06-04 11:01:00 -0300 |
---|---|---|
committer | Yaco <franco@reevo.org> | 2020-06-04 11:01:00 -0300 |
commit | fc7369835258467bf97eb64f184b93691f9a9fd5 (patch) | |
tree | daabd60089d2dd76d9f5fb416b005fbe159c799d /www/wiki/tests/phpunit/includes/collation/CollationFaTest.php |
first commit
Diffstat (limited to 'www/wiki/tests/phpunit/includes/collation/CollationFaTest.php')
-rw-r--r-- | www/wiki/tests/phpunit/includes/collation/CollationFaTest.php | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/www/wiki/tests/phpunit/includes/collation/CollationFaTest.php b/www/wiki/tests/phpunit/includes/collation/CollationFaTest.php new file mode 100644 index 00000000..f7455419 --- /dev/null +++ b/www/wiki/tests/phpunit/includes/collation/CollationFaTest.php @@ -0,0 +1,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" ], + ]; + } +} |