mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-13 08:34:12 +02:00
Merge remote-tracking branch 'upstream/master' into couchdb
This commit is contained in:
@@ -36,6 +36,7 @@ class BufferHandlerTest extends TestCase
|
||||
|
||||
/**
|
||||
* @covers Monolog\Handler\BufferHandler::close
|
||||
* @covers Monolog\Handler\BufferHandler::flush
|
||||
*/
|
||||
public function testDestructPropagatesRecords()
|
||||
{
|
||||
@@ -65,6 +66,36 @@ class BufferHandlerTest extends TestCase
|
||||
$this->assertFalse($test->hasDebugRecords());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Monolog\Handler\BufferHandler::handle
|
||||
*/
|
||||
public function testHandleBufferLimitWithFlushOnOverflow()
|
||||
{
|
||||
$test = new TestHandler();
|
||||
$handler = new BufferHandler($test, 3, Logger::DEBUG, true, true);
|
||||
|
||||
// send two records
|
||||
$handler->handle($this->getRecord(Logger::DEBUG));
|
||||
$handler->handle($this->getRecord(Logger::DEBUG));
|
||||
$handler->handle($this->getRecord(Logger::DEBUG));
|
||||
$this->assertFalse($test->hasDebugRecords());
|
||||
$this->assertCount(0, $test->getRecords());
|
||||
|
||||
// overflow
|
||||
$handler->handle($this->getRecord(Logger::INFO));
|
||||
$this->assertTrue($test->hasDebugRecords());
|
||||
$this->assertCount(3, $test->getRecords());
|
||||
|
||||
// should buffer again
|
||||
$handler->handle($this->getRecord(Logger::WARNING));
|
||||
$this->assertCount(3, $test->getRecords());
|
||||
|
||||
$handler->close();
|
||||
$this->assertCount(5, $test->getRecords());
|
||||
$this->assertTrue($test->hasWarningRecords());
|
||||
$this->assertTrue($test->hasInfoRecords());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Monolog\Handler\BufferHandler::handle
|
||||
*/
|
||||
@@ -81,4 +112,19 @@ class BufferHandlerTest extends TestCase
|
||||
$this->assertTrue($test->hasInfoRecords());
|
||||
$this->assertFalse($test->hasDebugRecords());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Monolog\Handler\BufferHandler::flush
|
||||
*/
|
||||
public function testFlush()
|
||||
{
|
||||
$test = new TestHandler();
|
||||
$handler = new BufferHandler($test, 0);
|
||||
$handler->handle($this->getRecord(Logger::DEBUG));
|
||||
$handler->handle($this->getRecord(Logger::INFO));
|
||||
$handler->flush();
|
||||
$this->assertTrue($test->hasInfoRecords());
|
||||
$this->assertTrue($test->hasDebugRecords());
|
||||
$this->assertFalse($test->hasWarningRecords());
|
||||
}
|
||||
}
|
||||
|
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
|
||||
namespace Monolog\Handler;
|
||||
use Monolog\Logger;
|
||||
|
||||
class SyslogHandlerTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
@@ -26,6 +27,9 @@ class SyslogHandlerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$handler = new SyslogHandler('test', 'user');
|
||||
$this->assertInstanceOf('Monolog\Handler\SyslogHandler', $handler);
|
||||
|
||||
$handler = new SyslogHandler('test', LOG_USER, Logger::DEBUG, true, LOG_PERROR);
|
||||
$this->assertInstanceOf('Monolog\Handler\SyslogHandler', $handler);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user