Brian Wolff has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/356067 )
Change subject: Unit tests for CollationFa (0bfcbd724)
..
Unit tests for CollationFa (0bfcbd724)
Change-Id: I8286244cc1a61f34a3599c4f2e6201ba91c5e79a
---
A tests/phpunit/includes/collation/CollationFaTest.php
1 file changed, 63 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/67/356067/1
diff --git a/tests/phpunit/includes/collation/CollationFaTest.php
b/tests/phpunit/includes/collation/CollationFaTest.php
new file mode 100644
index 000..735e386
--- /dev/null
+++ b/tests/phpunit/includes/collation/CollationFaTest.php
@@ -0,0 +1,63 @@
+ 'واو',
+ 4 => 'برلین',
+ 2 => 'ا',
+ 3 => 'ایران',
+ 1 => '۷',
+ 5 => 'و',
+ ];
+
+ $coll = new CollationFa;
+
+ $items = array_map( [ $coll, 'getSortKey' ], $items );
+ asort( $items );
+
+ $cur = 1;
+ foreach( $items as $key => $val ) {
+ $this->assertEquals( $key, $cur );
+ $cur++;
+ }
+ }
+
+ /**
+* @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" ],
+ ];
+ }
+}
--
To view, visit https://gerrit.wikimedia.org/r/356067
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8286244cc1a61f34a3599c4f2e6201ba91c5e79a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits