File: Text_LanguageDetect_ISO639Test.php

package info (click to toggle)
php-text-languagedetect 0.3.0-2.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 572 kB
  • sloc: php: 2,966; xml: 197; makefile: 2
file content (72 lines) | stat: -rw-r--r-- 1,532 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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')
        );
    }

}

?>