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

LibraryTest::testTextDomain()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 5
rs 9.4285
1
<?php
2
namespace CodeIgniterGetText\Tests;
3
4
class LibraryTest extends \PHPUnit_Framework_TestCase
5
{
6
7
    private function _regex($expression, $successful = TRUE)
8
    {
9
        $log = ($successful ? 'info' : 'debug');
10
        $regex = '/(' . $log . '|).*(' . $expression . ')/';
11
12
        return ($regex);
13
    }
14
15
    public function testCatalogCodeset()
16
    {
17
        $this->expectOutputRegex($this->_regex('bind text domain code set'));
18
        $this->_library();
19
    }
20
21
    public function testLocaleDir()
22
    {
23
        $this->expectOutputRegex($this->_regex('bind text domain directory'));
24
        $this->_library();
25
    }
26
27
    public function testTextDomain()
28
    {
29
        $this->expectOutputRegex($this->_regex('set text domain'));
30
        $this->_library();
31
    }
32
33
    public function testLocale()
34
    {
35
        $this->expectOutputRegex($this->_regex('set locale'));
36
        $this->_library();
37
    }
38
39
    public function testEnvironmentLanguage()
40
    {
41
        $this->expectOutputRegex($this->_regex('set environment language'));
42
        $this->_library();
43
    }
44
45
    public function testFileExists()
46
    {
47
        $this->expectOutputRegex($this->_regex('check MO file exists'));
48
        $this->_library();
49
    }
50
51
    private function _library()
52
    {
53
        $config = array();
54
55
        // Load default config array
56
        require(realpath(dirname(__FILE__) . '/../') . '/src/config/gettext.php');
57
58
        \Gettext::init($config);
59
    }
60
61
}
62