/
SyslogTest.php
56 lines (47 loc) · 1.2 KB
/
SyslogTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
namespace lithium\tests\cases\util\audit\logger\adapters;
use \lithium\util\audit\Logger;
use \lithium\util\audit\logger\adapters\Syslog;
/**
* Syslog adapter test.
*/
class SyslogTest extends \lithium\test\Unit {
public function setUp() {
$this->syslog = new Syslog();
Logger::config(array('syslog' => array('adapter' => $this->syslog)));
}
public function testConfiguration() {
$loggers = Logger::config();
$result = isset($loggers['syslog']);
$this->assertTrue($result);
}
public function testConstruct() {
$expected = array(
'identity' => false,
'options' => LOG_ODELAY,
'facility' => LOG_USER,
'priority' => LOG_INFO,
'init' => true
);
$result = $this->syslog->_config;
$this->assertEqual($expected, $result);
$syslog = new Syslog(array(
'identity' => 'SyslogTest',
'priority' => LOG_DEBUG
));
$expected = array(
'identity' => 'SyslogTest',
'options' => LOG_ODELAY,
'facility' => LOG_USER,
'priority' => LOG_DEBUG,
'init' => true
);
$result = $syslog->_config;
$this->assertEqual($expected, $result);
}
public function testWrite() {
$result = Logger::write('syslog', 'SyslogTest message...');
$this->assertTrue($result);
}
}
?>