Passed
Push — master ( be6e91...b708f5 )
by Joël
03:06 queued 14s
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_Exits()
10
    {
11
        $this->assertTrue(function_exists('__'), "__ function do not exists.");
12
    }
13
14
    public function testDoubleUnderscore()
15
    {
16
        $this->assertEquals(self::EXPRESSION, __(self::EXPRESSION));
17
    }
18
19
    public function testUnderscoreE_Exits()
20
    {
21
        $this->assertTrue(function_exists('_e'), "_e function do not exists.");
22
    }
23
24
    public function testUnderscroreE()
25
    {
26
        $this->expectOutputRegex('/' . self::EXPRESSION . '/');
27
        _e(self::EXPRESSION);
28
    }
29
30
    public function testUnderscoreN_Exits()
31
    {
32
        $this->assertTrue(function_exists('_n'), "_e function do not exists.");
33
    }
34
35
    public function testUnderscroreN_Singular()
36
    {
37
        $this->assertEquals(
38
            self::EXPRESSION,
39
            _n(self::EXPRESSION, self::EXPRESSION_PLURAL, 1)
40
        );
41
    }
42
43
    public function testUnderscroreN_Plural()
44
    {
45
        $this->assertEquals(
46
            self::EXPRESSION_PLURAL,
47
            _n(self::EXPRESSION, self::EXPRESSION_PLURAL, 2)
48
        );
49
    }
50
51
}