Test Failed
Push — master ( d46814...18961c )
by Joël
01:40
created

TranslationTest::testFrenchLocale()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 8
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 14
rs 9.4285
1
<?php
2
namespace CodeIgniterGetText\Tests;
3
4
class TranslationTest extends \PHPUnit_Framework_TestCase
5
{
6
    const EXPRESSION = "Let me test this expression";
7
8
    /**
9
     * @before
10
     */
11
    public function testFrenchLocale()
12
    {
13
        $config = array(
14
            'gettext_locale_dir' => 'testTranslations',
15
            'gettext_text_domain' => 'my-domain',
16
            'gettext_catalog_codeset' => 'UTF-8',
17
            'gettext_locale' => 'fr_FR'
18
        );
19
20
        // only for avoid output when launch test
21
        $this->expectOutputRegex('//');
22
23
        \Gettext::init($config);
24
    }
25
26
    public function testDoubleUnderscore()
27
    {
28
        $this->assertEquals("Une expression en Français", __("A expression in English"));
29
    }
30
31
    public function testUnderscroreE()
32
    {
33
        $this->expectOutputRegex("/(Une expression en Français)$/");
34
        _e("A expression in English");
35
    }
36
37
    public function testUnderscroreN_Singular()
38
    {
39
        $this->assertEquals(
40
            "Une expression en Français", __("A expression in English"), 1
41
        );
42
    }
43
44
    public function testUnderscroreN_Plural()
45
    {
46
        $this->assertEquals(
47
            "Une expression en Français", __("A expression in English"), 2
48
        );
49
    }
50
51
}