aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/includes/LanguageTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/includes/LanguageTest.php')
-rw-r--r--tests/unit/includes/LanguageTest.php50
1 files changed, 1 insertions, 49 deletions
diff --git a/tests/unit/includes/LanguageTest.php b/tests/unit/includes/LanguageTest.php
index 9525c783d..8f62e71e2 100644
--- a/tests/unit/includes/LanguageTest.php
+++ b/tests/unit/includes/LanguageTest.php
@@ -33,54 +33,6 @@ use Text_LanguageDetect;
* @author Klaus Weidenbach
*/
class LanguageTest extends UnitTestCase {
- //use PHPMock;
-
- /**
- * @dataProvider languageExamplesProvider
- * @coversNothing
- */
- public function testDetectLanguage($text, $langCode, $confidence) {
-
- // php-mock can not mock global functions which is called by a global function.
- // If the calling function is in a namespace it would work.
- //$gc = $this->getFunctionMock(__NAMESPACE__, 'get_config');
- //$gc->expects($this->once())->willReturn(10)
- //$cg = $this->getFunctionMock('Zotlabs\Lib\Config', 'Get');
- //$cg->expects($this->once())->willReturn(10);
- //$this->assertEquals($langCode, detect_language($text));
-
-
- // Can not unit test detect_language(), therefore test the used library
- // only for now to find regressions on library updates.
- $l = new Text_LanguageDetect;
- // return 2-letter ISO 639-1 (en) language code
- $l->setNameMode(2);
- $lng = $l->detectConfidence($text);
-
- $this->assertEquals($langCode, $lng['language']);
- $this->assertEquals($confidence, round($lng['confidence'], 6));
- }
-
- public function languageExamplesProvider() {
- return [
- 'English' => [
- 'English is a West Germanic language that was first spoken in early medieval England and is now a global lingua franca.[4][5] Named after the Angles, one of the Germanic tribes that migrated to England, it ultimately derives its name from the Anglia (Angeln) peninsula in the Baltic Sea. It is closely related to the Frisian languages, but its vocabulary has been significantly influenced by other Germanic languages, particularly Norse (a North Germanic language), as well as by Latin and Romance languages, especially French.',
- 'en',
- 0.078422
- ],
- 'German' => [
- 'Deutschland ist ein Bundesstaat in Mitteleuropa. Er besteht aus 16 Ländern und ist als freiheitlich-demokratischer und sozialer Rechtsstaat verfasst. Die Bundesrepublik Deutschland stellt die jüngste Ausprägung des deutschen Nationalstaates dar. Mit rund 82,8 Millionen Einwohnern (31. Dezember 2016) zählt Deutschland zu den dicht besiedelten Flächenstaaten.',
- 'de',
- 0.134339
- ],
- 'Norwegian' => [
- 'Kongeriket Norge er et nordisk, europeisk land og en selvstendig stat vest på Den skandinaviske halvøy. Landet er langt og smalt, og kysten strekker seg langs Nord-Atlanteren, hvor også Norges kjente fjorder befinner seg. Totalt dekker det relativt tynt befolkede landet 385 000 kvadratkilometer med litt over fem millioner innbyggere (2016).',
- 'no',
- 0.007076
- ]
- ];
- }
-
/**
* @covers ::get_language_name
@@ -94,7 +46,7 @@ class LanguageTest extends UnitTestCase {
}
}
- public function getLanguageNameProvider() {
+ public static function getLanguageNameProvider() {
return [
'empty language code' => [
'',