1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-06 13:16:39 +02:00

Pass $record['formatted'] as the user parameter for zend monitor. Refactored test.

This commit is contained in:
ChristianB
2013-01-31 10:39:11 +01:00
parent 5a2a9129d4
commit 83b84ff818
2 changed files with 27 additions and 9 deletions

View File

@@ -40,16 +40,31 @@ class ZendMonitorHandlerTest extends TestCase
public function testWrite()
{
$record = $this->getRecord();
$formatterResult = array(
'message' => $record['message']
);
$zendMonitor = $this->getMockBuilder('Monolog\Handler\ZendMonitorHandler')
->setMethods(array('writeZendMonitorCustomEvent'))
->getMock();
->setMethods(array('writeZendMonitorCustomEvent', 'getDefaultFormatter'))
->getMock();
$formatterMock = $this->getMockBuilder('Monolog\Formatter\NormalizerFormatter')
->disableOriginalConstructor()
->getMock();
$formatterMock->expects($this->once())
->method('format')
->will($this->returnValue($formatterResult));
$zendMonitor->expects($this->once())
->method('getDefaultFormatter')
->will($this->returnValue($formatterMock));
$levelMap = $zendMonitor->getLevelMap();
$zendMonitor->expects($this->once())
->method('writeZendMonitorCustomEvent')
->with($levelMap[$record['level']], $record['message']);
->method('writeZendMonitorCustomEvent')
->with($levelMap[$record['level']], $record['message'], $formatterResult);
$zendMonitor->handle($record);
}