Completed
Pull Request — master (#10)
by Artem
01:12
created

RussianToEnglishTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 89
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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