1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-11 23:54:04 +02:00

Merge branch '1.x'

This commit is contained in:
Jordi Boggiano
2016-09-25 17:41:12 +02:00
3 changed files with 59 additions and 28 deletions

View File

@@ -11,10 +11,12 @@
namespace Monolog\Handler;
use Monolog\Test\TestCase;
/**
* @requires extension sockets
*/
class SyslogUdpHandlerTest extends \PHPUnit_Framework_TestCase
class SyslogUdpHandlerTest extends TestCase
{
/**
* @expectedException UnexpectedValueException
@@ -45,6 +47,23 @@ class SyslogUdpHandlerTest extends \PHPUnit_Framework_TestCase
$handler->handle($this->getRecordWithMessage("hej\nlol"));
}
public function testSplitWorksOnEmptyMsg()
{
$handler = new SyslogUdpHandler("127.0.0.1", 514, "authpriv");
$handler->setFormatter($this->getIdentityFormatter());
$socket = $this->getMockBuilder('\Monolog\Handler\SyslogUdp\UdpSocket')
->setMethods(['write'])
->setConstructorArgs(['lol', 'lol'])
->getMock();
$socket->expects($this->never())
->method('write');
$handler->setSocket($socket);
$handler->handle($this->getRecordWithMessage(null));
}
protected function getRecordWithMessage($msg)
{
return ['message' => $msg, 'level' => \Monolog\Logger::WARNING, 'context' => null, 'extra' => [], 'channel' => 'lol'];