Completed
Pull Request — master (#8)
by
unknown
02:02
created

RussianToEnglishTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 102
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
c 1
b 0
f 1
lcom 1
cbo 2
dl 0
loc 102
rs 10
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
11
namespace Tests\Fresh\Transliteration;
12
13
use Fresh\Transliteration\Transliterator;
14
15
/**
16
 * RussianToEnglish Transliterator Test
17
 *
18
 * @author Mykhailo Vilshansky <[email protected]>
19
 */
20
class RussianToEnglishTest extends \PHPUnit_Framework_TestCase
21
{
22
    /**
23
     * @var Transliterator
24
     */
25
    protected $transliterator;
26
27
    /**
28
     * Set up environment
29
     */
30
    public function setUp()
31
    {
32
        $this->transliterator = new Transliterator();
33
    }
34
35
    /**
36
     * Test transliteration from Russian to English
37
     *
38
     * @param array $russianText      Russian text
39
     * @param array $transliteratedText Expected transliterated text
40
     *
41
     * @test
42
     * @covers \Fresh\Transliteration\Transliterator
43
     * @covers \Fresh\Transliteration\RussianToEnglish
44
     * @dataProvider dataProvider
45
     */
46
    public function transliterationFromRussianToEnglish($russianText, $transliteratedText)
47
    {
48
        $this->assertEquals($transliteratedText, $this->transliterator->ruToEn($russianText));
49
    }
50
51
    /**
52
     * Data provider for transliteration from Russian to English
53
     *
54
     * @return array
55
     */
56
    public function dataProvider()
57
    {
58
        return [
59
            // Russian alphabet
60
            ['а', 'a'],
61
            ['б', 'b'],
62
            ['в', 'v'],
63
            ['г', 'g'],
64
            ['д', 'd'],
65
            ['е', 'e'],
66
            ['ё', 'e'],
67
            ['ж', 'zh'],
68
            ['з', 'z'],
69
            ['и', 'i'],
70
            ['й', 'y'],
71
            ['к', 'k'],
72
            ['л', 'l'],
73
            ['м', 'm'],
74
            ['н', 'n'],
75
            ['о', 'o'],
76
            ['п', 'p'],
77
            ['р', 'r'],
78
            ['с', 's'],
79
            ['т', 't'],
80
            ['у', 'u'],
81
            ['ф', 'f'],
82
            ['х', 'h'],
83
            ['ц', 'ts'],
84
            ['ч', 'ch'],
85
            ['ш', 'sh'],
86
            ['щ', 'sht'], 
87
            ['ь', '\''],
88
            ['ы', 'y'],
89
            ['ъ', '\''],
90
            ['ю', 'yu'],
91
            ['я', 'ya'],
92
            ['А', 'A'],
93
            ['Б', 'B'],
94
            ['В', 'V'],
95
            ['Г', 'G'],
96
            ['Д', 'D'],
97
            ['Е', 'E'],
98
            ['Ж', 'Zh'],
99
            ['З', 'Z'],
100
            ['И', 'I'],
101
            ['Й', 'Y'],
102
            ['К', 'K'],
103
            ['Л', 'L'],
104
            ['М', 'M'],
105
            ['Н', 'N'],
106
            ['О', 'O'],
107
            ['П', 'P'],
108
            ['Р', 'R'],
109
            ['С', 'S'],
110
            ['Т', 'T'],
111
            ['У', 'U'],
112
            ['Ф', 'F'],
113
            ['Х', 'H'],
114
            ['Ц', 'Ts'],
115
            ['Ч', 'Ch'],
116
            ['Ш', 'Sh'],
117
            ['Щ', 'Sht'],
118
            ['Ь', '\''],
119
            ['Ы','Y]',
120
            ['Ъ','\''],
121
            ['Ю', 'Yu'],
122
            ['Я', 'Ya'],
123
        ];
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected ';', expecting ']'
Loading history...
124
    }
125
}
126