ZhConverterTest   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 6
eloc 9
dl 0
loc 63
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A testTo() 0 3 1
A testToTW() 0 3 1
A testToHk() 0 3 1
A textsProvider() 0 5 1
A testToMo() 0 3 1
A testToCN() 0 3 1
1
<?php
2
namespace RazonYang\MediaWiki\ZhConverter\Tests;
3
4
use PHPUnit\Framework\TestCase;
5
use RazonYang\MediaWiki\ZhConverter\ZhConverter;
6
7
class ZhConverterTest extends TestCase
8
{
9
    public function textsProvider()
10
    {
11
        return [
12
            ['书本', '書本'],
13
            ['面包', '麵包'],
14
        ];
15
    }
16
17
    /**
18
     * @param string $text
19
     * @param string $expected
20
     *
21
     * @dataProvider textsProvider
22
     */
23
    public function testToCN($expected, $text)
24
    {
25
        $this->assertEquals($expected, ZhConverter::toCN($text));
26
    }
27
28
    /**
29
     * @param string $text
30
     * @param string $expected
31
     *
32
     * @dataProvider textsProvider
33
     */
34
    public function testToTW($text, $expected)
35
    {
36
        $this->assertEquals($expected, ZhConverter::toTW($text));
37
    }
38
39
    /**
40
     * @param string $text
41
     * @param string $expected
42
     *
43
     * @dataProvider textsProvider
44
     */
45
    public function testToHk($text, $expected)
46
    {
47
        $this->assertEquals($expected, ZhConverter::toHK($text));
48
    }
49
50
    /**
51
     * @param string $text
52
     * @param string $expected
53
     *
54
     * @dataProvider textsProvider
55
     */
56
    public function testToMo($text, $expected)
57
    {
58
        $this->assertEquals($expected, ZhConverter::toMO($text));
59
    }
60
61
    /**
62
     * @param string $text
63
     * @param string $expected
64
     *
65
     * @dataProvider textsProvider
66
     */
67
    public function testTo($expected, $text)
68
    {
69
        $this->assertEquals($expected, ZhConverter::to('zh-sg', $text));
70
    }
71
}
72