Completed
Push — master ( 36456a...28c3a3 )
by Artem
02:09
created

testTransliterationFromRussianToEnglish()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
1
<?php
2
/*
3
 * This file is part of the Transliteration library
4
 *
5
 * (c) Mykhailo Vilshansky <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace Tests\Fresh\Transliteration;
11
12
use Fresh\Transliteration\Transliterator;
13
14
/**
15
 * RussianToEnglish Transliterator Test.
16
 *
17
 * @author Artem Genvald <[email protected]>
18
 * @author Mykhailo Vilshansky <[email protected]>
19
 */
20
class RussianToEnglishTest extends \PHPUnit_Framework_TestCase
21
{
22
    protected $transliterator;
23
24
    public function setUp()
25
    {
26
        $this->transliterator = new Transliterator();
27
    }
28
29
    /**
30
     * @dataProvider dataProvider
31
     */
32
    public function testTransliterationFromRussianToEnglish($russianText, $transliteratedText)
33
    {
34
        $this->assertEquals($transliteratedText, $this->transliterator->ruToEn($russianText));
35
    }
36
37
    public function dataProvider()
38
    {
39
        return [
40
            // Russian alphabet
41
            ['а', 'a'],
42
            ['б', 'b'],
43
            ['в', 'v'],
44
            ['г', 'g'],
45
            ['д', 'd'],
46
            ['е', 'e'],
47
            ['ё', 'e'],
48
            ['ж', 'zh'],
49
            ['з', 'z'],
50
            ['и', 'i'],
51
            ['й', 'y'],
52
            ['к', 'k'],
53
            ['л', 'l'],
54
            ['м', 'm'],
55
            ['н', 'n'],
56
            ['о', 'o'],
57
            ['п', 'p'],
58
            ['р', 'r'],
59
            ['с', 's'],
60
            ['т', 't'],
61
            ['у', 'u'],
62
            ['ф', 'f'],
63
            ['х', 'h'],
64
            ['ц', 'ts'],
65
            ['ч', 'ch'],
66
            ['ш', 'sh'],
67
            ['щ', 'sht'],
68
            ['ь', ''],
69
            ['ы', 'y'],
70
            ['ъ', ''],
71
            ['ю', 'yu'],
72
            ['я', 'ya'],
73
            ['А', 'A'],
74
            ['Б', 'B'],
75
            ['В', 'V'],
76
            ['Г', 'G'],
77
            ['Д', 'D'],
78
            ['Е', 'E'],
79
            ['Ж', 'Zh'],
80
            ['З', 'Z'],
81
            ['И', 'I'],
82
            ['Й', 'Y'],
83
            ['К', 'K'],
84
            ['Л', 'L'],
85
            ['М', 'M'],
86
            ['Н', 'N'],
87
            ['О', 'O'],
88
            ['П', 'P'],
89
            ['Р', 'R'],
90
            ['С', 'S'],
91
            ['Т', 'T'],
92
            ['У', 'U'],
93
            ['Ф', 'F'],
94
            ['Х', 'H'],
95
            ['Ц', 'Ts'],
96
            ['Ч', 'Ch'],
97
            ['Ш', 'Sh'],
98
            ['Щ', 'Sht'],
99
            ['Ь', ''],
100
            ['Ы', 'Y'],
101
            ['Ъ', ''],
102
            ['Ю', 'Yu'],
103
            ['Я', 'Ya'],
104
        ];
105
    }
106
}
107