Files
mediawiki-extensions-Univer…/tests/phpunit/LanguageSearchTest.php
Amire80 101532cfa6 Add special language names to facilitate searching
This adds several custom languages.

The addition of Punjabi addresses Bug T178070.

The addition of Chinese addresses Bug T73891.

Georgian and Catalan (Valencian) variant spellings
are added because these are the most frequent languages
that are not found in the ULS search box.

Bug: T73891
Bug: T178070
Change-Id: Ifbb08b560e454643d246379c19f725bde61917e9
2017-10-25 13:50:12 +05:30

92 lines
2.4 KiB
PHP

<?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, $expected ) {
$actual = LanguageNameSearch::search( $searchKey, 1 );
$this->assertEquals( $expected, $actual );
}
public function searchDataProvider() {
return [
[ 'ഹിന്ദി', [
'hi' => 'ഹിന്ദി'
]
],
[ 'മല', [
'ml' => 'മലയാളം',
'mg' => 'മലഗാസി',
'ms' => 'മലെയ്',
]
],
[ 'Φινλαν', [
'fi' => 'φινλανδικά',
]
],
[ 'blah', []
],
[ 'الفرنسية', [
'fr' => 'الفرنسية',
'fr-ca' => 'الفرنسية الكندية',
'fr-ch' => 'الفرنسية السويسرية',
'frm' => 'الفرنسية الوسطى',
'fro' => 'الفرنسية القديمة',
'crs' => 'الفرنسية الكريولية السيشيلية'
]
],
[ 'മലയളം', [
'ml' => 'മലയാളം',
]
],
[ 'punja', [
'pa' => 'punjaabi sennii',
'pnb' => 'punjabi western',
]
],
[ 'kartuli', [
'ka' => 'kartuli',
]
],
[ 'valencia', [
'ca' => 'valencia',
]
],
[ 'chinese', [
'zh-hans' => 'chinese simplified',
'zh-hant' => 'chinese traditional',
'zh' => 'chinesesch',
'zh-cn' => 'chinese (china)',
'zh-hk' => 'chinese (hong kong)',
'zh-min-nan' => 'chinese (min nan)',
'zh-sg' => 'chinese (singapore)',
'zh-tw' => 'chinese (taiwan)'
]
],
[ 'finish', [
'fi' => 'finnish'
]
],
];
}
}