Cross-language language name search
Implementation of Also Written As language name search algorithm. See http://etherpad.wikimedia.org/l10n-uls-language-search Change-Id: Iff84408c531b650a44d031b63d5c823737cceafc
This commit is contained in:
59
tests/phpunit/LanguageSearchTest.php
Normal file
59
tests/phpunit/LanguageSearchTest.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPUnit tests for UniversalLanguageSelector extension.
|
||||
*
|
||||
* Copyright (C) 2012 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris,
|
||||
* Niklas Laxström, Pau Giner, Santhosh Thottingal, Siebrand Mazeland and other
|
||||
* contributors. See CREDITS for a list.
|
||||
*
|
||||
* UniversalLanguageSelector is dual licensed GPLv2 or later and MIT. You don't
|
||||
* have to do anything special to choose one license or the other and you don't
|
||||
* have to notify anyone which license you are using. You are free to use
|
||||
* UniversalLanguageSelector in commercial projects as long as the copyright
|
||||
* header is left intact. See files GPL-LICENSE and MIT-LICENSE for details.
|
||||
*
|
||||
* @file
|
||||
* @ingroup Extensions
|
||||
* @licence GNU General Public Licence 2.0 or later
|
||||
* @licence MIT License
|
||||
*/
|
||||
require_once( __DIR__ . '/../../data/LanguageNameSearch.php' );
|
||||
class LanguageSearchTest extends PHPUnit_Framework_TestCase {
|
||||
|
||||
/**
|
||||
* @dataProvider searchDataProvider
|
||||
*/
|
||||
public function testSearch( $searchKey, $result ) {
|
||||
$this->assertEquals( $result, LanguageNameSearch::search( $searchKey ) );
|
||||
}
|
||||
|
||||
public function searchDataProvider() {
|
||||
return array(
|
||||
array( "ഹിന്ദി", array(
|
||||
'hi' => 'ഹിന്ദി'
|
||||
)
|
||||
),
|
||||
array( "മല", array(
|
||||
'ml' => "മലയാളം",
|
||||
'mg' => 'മലഗാസി',
|
||||
'ms' => 'മലയ',
|
||||
)
|
||||
),
|
||||
array( "Φινλαν", array(
|
||||
'fi' => 'Φινλανδικά',
|
||||
)
|
||||
),
|
||||
array( "blah", array(
|
||||
)
|
||||
),
|
||||
array( "الفرنسية", array(
|
||||
'fr' => 'الفرنسية',
|
||||
'fr-ca' => 'الفرنسية الكندية',
|
||||
'fr-ch' => 'الفرنسية السويسرية',
|
||||
'frm' => 'الفرنسية الوسطى',
|
||||
'fro' => 'الفرنسية القديمة',
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user