1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-10 15:14:14 +02:00

Make sure handlers can be closed multiple times

This commit is contained in:
Jordi Boggiano
2015-08-09 17:29:31 +01:00
parent d93492fb60
commit 3dccef613e
4 changed files with 40 additions and 2 deletions

View File

@@ -12,6 +12,7 @@
namespace Monolog\Handler;
use Monolog\TestCase;
use Monolog\Handler\SyslogUdp\UdpSocket;
/**
* @requires extension sockets
@@ -43,4 +44,21 @@ class UdpSocketTest extends TestCase
$socket->write($longString, "HEADER");
}
public function testDoubleCloseDoesNotError()
{
$socket = new UdpSocket('127.0.0.1', 514);
$socket->close();
$socket->close();
}
/**
* @expectedException LogicException
*/
public function testWriteAfterCloseErrors()
{
$socket = new UdpSocket('127.0.0.1', 514);
$socket->close();
$socket->write('foo', "HEADER");
}
}