Passed
Push — master ( be6e91...b708f5 )
by Joël
03:06 queued 14s
created

HelperTest   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 48
rs 10
c 1
b 0
f 0
wmc 7
lcom 2
cbo 1

7 Methods

Rating   Name   Duplication   Size   Complexity  
A testDoubleUnderscore_Exits() 0 4 1
A testDoubleUnderscore() 0 4 1
A testUnderscoreE_Exits() 0 4 1
A testUnderscroreE() 0 5 1
A testUnderscoreN_Exits() 0 4 1
A testUnderscroreN_Singular() 0 7 1
A testUnderscroreN_Plural() 0 7 1
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
}