aboutsummaryrefslogtreecommitdiffstats
path: root/library/langdet/tests/Text_LanguageDetect_ISO639Test.php
diff options
context:
space:
mode:
authorSimon L'nu <simon.lnu@gmail.com>2012-05-13 18:50:04 -0400
committerSimon L'nu <simon.lnu@gmail.com>2012-05-13 18:50:04 -0400
commit39c042f4ea33abd77d6431c531b6eae72f2d7994 (patch)
tree91cef4041bbdfbc1fe08ffb08c52661d70c59f94 /library/langdet/tests/Text_LanguageDetect_ISO639Test.php
parentf267a283b46edaf389e99ef3ea4341a5a0496aab (diff)
parent303856ce01983feec95539892a908b5d5a88f866 (diff)
downloadvolse-hubzilla-39c042f4ea33abd77d6431c531b6eae72f2d7994.tar.gz
volse-hubzilla-39c042f4ea33abd77d6431c531b6eae72f2d7994.tar.bz2
volse-hubzilla-39c042f4ea33abd77d6431c531b6eae72f2d7994.zip
Merge branch 'master', remote-tracking branch 'remotes/upstream/master'
* remotes/upstream/master: diabook-theme: small fixes rename get_language() to get_browser_language() slackr drop shadows language detection library rev update * master:
Diffstat (limited to 'library/langdet/tests/Text_LanguageDetect_ISO639Test.php')
-rw-r--r--library/langdet/tests/Text_LanguageDetect_ISO639Test.php72
1 files changed, 72 insertions, 0 deletions
diff --git a/library/langdet/tests/Text_LanguageDetect_ISO639Test.php b/library/langdet/tests/Text_LanguageDetect_ISO639Test.php
new file mode 100644
index 000000000..e01d715e1
--- /dev/null
+++ b/library/langdet/tests/Text_LanguageDetect_ISO639Test.php
@@ -0,0 +1,72 @@
+<?php
+set_include_path(
+ __DIR__ . '/../' . PATH_SEPARATOR . get_include_path()
+);
+
+require_once 'Text/LanguageDetect/ISO639.php';
+
+class Text_LanguageDetect_ISO639Test extends PHPUnit_Framework_TestCase
+{
+ public function testNameToCode2()
+ {
+ $this->assertEquals(
+ 'de',
+ Text_LanguageDetect_ISO639::nameToCode2('german')
+ );
+ }
+
+ public function testNameToCode2Fail()
+ {
+ $this->assertNull(
+ Text_LanguageDetect_ISO639::nameToCode2('doesnotexist')
+ );
+ }
+
+ public function testNameToCode3()
+ {
+ $this->assertEquals(
+ 'fra',
+ Text_LanguageDetect_ISO639::nameToCode3('french')
+ );
+ }
+
+ public function testNameToCode3Fail()
+ {
+ $this->assertNull(
+ Text_LanguageDetect_ISO639::nameToCode3('doesnotexist')
+ );
+ }
+
+ public function testCode2ToName()
+ {
+ $this->assertEquals(
+ 'english',
+ Text_LanguageDetect_ISO639::code2ToName('en')
+ );
+ }
+
+ public function testCode2ToNameFail()
+ {
+ $this->assertNull(
+ Text_LanguageDetect_ISO639::code2ToName('nx')
+ );
+ }
+
+ public function testCode3ToName()
+ {
+ $this->assertEquals(
+ 'romanian',
+ Text_LanguageDetect_ISO639::code3ToName('rom')
+ );
+ }
+
+ public function testCode3ToNameFail()
+ {
+ $this->assertNull(
+ Text_LanguageDetect_ISO639::code3ToName('nxx')
+ );
+ }
+
+}
+
+?> \ No newline at end of file