1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-26 22:44:29 +02:00

Merge branch '1.x'

This commit is contained in:
Jordi Boggiano
2016-11-13 20:26:27 +01:00
5 changed files with 51 additions and 6 deletions

View File

@@ -203,6 +203,32 @@ class RavenHandlerTest extends TestCase
$handler->handleBatch($records);
}
public function testHandleBatchPicksProperMessage()
{
$records = array(
$this->getRecord(Logger::DEBUG, 'debug message 1'),
$this->getRecord(Logger::DEBUG, 'debug message 2'),
$this->getRecord(Logger::INFO, 'information 1'),
$this->getRecord(Logger::ERROR, 'error 1'),
$this->getRecord(Logger::WARNING, 'warning'),
$this->getRecord(Logger::ERROR, 'error 2'),
$this->getRecord(Logger::INFO, 'information 2'),
);
$logFormatter = $this->getMock('Monolog\\Formatter\\FormatterInterface');
$logFormatter->expects($this->once())->method('formatBatch');
$formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface');
$formatter->expects($this->once())->method('format')->with($this->callback(function ($record) use ($records) {
return $record['message'] == 'error 1';
}));
$handler = $this->getHandler($this->getRavenClient());
$handler->setBatchFormatter($logFormatter);
$handler->setFormatter($formatter);
$handler->handleBatch($records);
}
public function testGetSetBatchFormatter()
{
$ravenClient = $this->getRavenClient();