1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-07-30 01:40:30 +02:00

Fix SyslogUdpHandler tests

This commit is contained in:
Jordi Boggiano
2019-07-06 13:29:30 +02:00
parent 0c3811c8b1
commit 81108d4e8a
2 changed files with 9 additions and 2 deletions

View File

@@ -415,6 +415,10 @@ class Logger implements LoggerInterface, ResettableInterface
throw new InvalidArgumentException('Level "'.$level.'" is not defined, use one of: '.implode(', ', array_keys(static::$levels)));
}
if (!is_int($level)) {
throw new InvalidArgumentException('Level "'.var_export($level, true).'" is not defined, use one of: '.implode(', ', array_keys(static::$levels)));
}
return $level;
}

View File

@@ -83,7 +83,7 @@ class SyslogUdpHandlerTest extends TestCase
$host = gethostname();
$handler = $this->getMockBuilder('\Monolog\Handler\SyslogUdpHandler')
->setConstructorArgs(array("127.0.0.1", 514, "authpriv", null, null, "php", \Monolog\Handler\SyslogUdpHandler::RFC3164))
->setConstructorArgs(array("127.0.0.1", 514, "authpriv", 'debug', true, "php", \Monolog\Handler\SyslogUdpHandler::RFC3164))
->setMethods(array('getDateTime'))
->getMock();
@@ -92,7 +92,10 @@ class SyslogUdpHandlerTest extends TestCase
$handler->setFormatter(new \Monolog\Formatter\ChromePHPFormatter());
$socket = $this->getMock('\Monolog\Handler\SyslogUdp\UdpSocket', array('write'), array('lol', 'lol'));
$socket = $this->getMockBuilder('\Monolog\Handler\SyslogUdp\UdpSocket')
->setConstructorArgs(array('lol', 999))
->setMethods(array('write'))
->getMock();
$socket->expects($this->at(0))
->method('write')
->with("lol", "<".(LOG_AUTHPRIV + LOG_WARNING).">$time $host php[$pid]: ");