1 | <?php |
||
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 |