]> git.mxchange.org Git - friendica.git/blob - library/langdet/tests/Text_LanguageDetect_ISO639Test.php
Merge pull request #3678 from tobiasd/20170904-langdet
[friendica.git] / library / langdet / tests / Text_LanguageDetect_ISO639Test.php
1 <?php
2 set_include_path(
3     __DIR__ . '/../' . PATH_SEPARATOR . get_include_path()
4 );
5
6 require_once 'Text/LanguageDetect/ISO639.php';
7
8 class Text_LanguageDetect_ISO639Test extends PHPUnit_Framework_TestCase
9 {
10     public function testNameToCode2()
11     {
12         $this->assertEquals(
13             'de', 
14             Text_LanguageDetect_ISO639::nameToCode2('german')
15         );
16     }
17
18     public function testNameToCode2Fail()
19     {
20         $this->assertNull(
21             Text_LanguageDetect_ISO639::nameToCode2('doesnotexist')
22         );
23     }
24
25     public function testNameToCode3()
26     {
27         $this->assertEquals(
28             'fra', 
29             Text_LanguageDetect_ISO639::nameToCode3('french')
30         );
31     }
32
33     public function testNameToCode3Fail()
34     {
35         $this->assertNull(
36             Text_LanguageDetect_ISO639::nameToCode3('doesnotexist')
37         );
38     }
39
40     public function testCode2ToName()
41     {
42         $this->assertEquals(
43             'english', 
44             Text_LanguageDetect_ISO639::code2ToName('en')
45         );
46     }
47
48     public function testCode2ToNameFail()
49     {
50         $this->assertNull(
51             Text_LanguageDetect_ISO639::code2ToName('nx')
52         );
53     }
54
55     public function testCode3ToName()
56     {
57         $this->assertEquals(
58             'romanian', 
59             Text_LanguageDetect_ISO639::code3ToName('rom')
60         );
61     }
62
63     public function testCode3ToNameFail()
64     {
65         $this->assertNull(
66             Text_LanguageDetect_ISO639::code3ToName('nxx')
67         );
68     }
69
70 }
71
72 ?>