ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
SyslogUdpHandlerTest.php
Go to the documentation of this file.
1<?php
2
3/*
4 * This file is part of the Monolog package.
5 *
6 * (c) Jordi Boggiano <j.boggiano@seld.be>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Monolog\Handler;
13
18{
22 public function testWeValidateFacilities()
23 {
24 $handler = new SyslogUdpHandler("ip", null, "invalidFacility");
25 }
26
27 public function testWeSplitIntoLines()
28 {
29 $handler = new SyslogUdpHandler("127.0.0.1", 514, "authpriv");
30 $handler->setFormatter(new \Monolog\Formatter\ChromePHPFormatter());
31
32 $socket = $this->getMock('\Monolog\Handler\SyslogUdp\UdpSocket', array('write'), array('lol', 'lol'));
33 $socket->expects($this->at(0))
34 ->method('write')
35 ->with("lol", "<".(LOG_AUTHPRIV + LOG_WARNING).">1 ");
36 $socket->expects($this->at(1))
37 ->method('write')
38 ->with("hej", "<".(LOG_AUTHPRIV + LOG_WARNING).">1 ");
39
40 $handler->setSocket($socket);
41
42 $handler->handle($this->getRecordWithMessage("hej\nlol"));
43 }
44
45 protected function getRecordWithMessage($msg)
46 {
47 return array('message' => $msg, 'level' => \Monolog\Logger::WARNING, 'context' => null, 'extra' => array(), 'channel' => 'lol');
48 }
49}
Formats a log message according to the ChromePHP array format.
testWeValidateFacilities()
@expectedException UnexpectedValueException
A Handler for logging to a remote syslogd server.
const WARNING
Exceptional occurrences that are not errors.
Definition: Logger.php:52