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

HelperTest::testUnderscroreN_Plural()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 7
rs 9.4285
c 1
b 0
f 0
1
<?php
2
namespace CodeIgniterGetText\Tests;
3
4
class HelperTest extends \PHPUnit_Framework_TestCase
5
{
6
    const EXPRESSION = "Let me test this expression";
7
    const EXPRESSION_PLURAL = "Let me test this plural expression";
8
9
    public function testDoubleUnderscore()
10
    {
11
        $this->assertTrue(function_exists('__'), "__ function do not exists.");
12
        $this->assertEquals(self::EXPRESSION, __(self::EXPRESSION));
13
    }
14
15
    public function testUnderscoreE()
16
    {
17
        $this->assertTrue(function_exists('_e'), "_e function do not exists.");
18
        $this->expectOutputRegex('/' . self::EXPRESSION . '/');
19
        _e(self::EXPRESSION);
20
    }
21
22
    public function testUnderscroreN_Singular()
23
    {
24
        $this->assertTrue(function_exists('_n'), "_e function do not exists.");
25
        $this->assertEquals(
26
            self::EXPRESSION,
27
            _n(self::EXPRESSION, self::EXPRESSION_PLURAL, 1)
28
        );
29
    }
30
31
    public function testUnderscroreN_Plural()
32
    {
33
        $this->assertTrue(function_exists('_n'), "_e function do not exists.");
34
        $this->assertEquals(
35
            self::EXPRESSION_PLURAL,
36
            _n(self::EXPRESSION, self::EXPRESSION_PLURAL, 2)
37
        );
38
    }
39
40
}