Completed
Push — master ( 1e1151...e2efc7 )
by Artem
14s
created

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