Completed
Push — master ( db908f...0d27db )
by raphael
11s
created

conversionLocaleDataProvider()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 7
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 10
rs 9.4285
1
<?php
2
namespace Rap2hpoutre\ConvertAccentCharacters\Tests;
3
4
use PHPUnit\Framework\TestCase;
5
use function Rap2hpoutre\ConvertAccentCharacters\convert_accent_characters;
6
7
/**
8
 * Class ConvertAccentCharactersTest
9
 * @package Rap2hpoutre\ConvertAccentCharacters\Tests
10
 */
11
class ConvertAccentCharactersTest extends TestCase
12
{
13
    public function conversionDataProvider()
14
    {
15
        return [
16
            ['Hello', 'Hello'],
17
            ['Ca plait a sa majeste', 'Ça plaît à sa majesté'],
18
            ['Wikipedia', 'Wikipédia'],
19
        ];
20
    }
21
22
    /**
23
     * @dataProvider conversionDataProvider
24
     */
25
    public function testConversion($expectedString, $string)
26
    {
27
        $this->assertEquals($expectedString, convert_accent_characters($string));
28
    }
29
30
    public function conversionLocaleDataProvider()
31
    {
32
        return [
33
            ['Strass', 'Straß', 'de_DE'],
34
            ['Stras', 'Straß', 'da_DK'],
35
            ['Stras', 'Straß', 'ca'],
36
            ['Stras', 'Straß', 'sr_RS'],
37
            ['Stras', 'Straß', 'bs_BA'],
38
        ];
39
    }
40
41
    /**
42
     * @dataProvider conversionLocaleDataProvider
43
     */
44
    public function testConversionWithLocale($expectedString, $string, $locale)
45
    {
46
        $this->assertEquals($expectedString, convert_accent_characters($string, $locale));
47
    }
48
}
49