1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-07 13:46:38 +02:00

Added a Processor stack to the Logger class, added getHandler() to check if any handler is going to handle the message before processing it, handlers are now calling their parent in a chain

This commit is contained in:
Jordi Boggiano
2011-02-21 20:38:18 +01:00
parent 8d27400122
commit a426ce2815
5 changed files with 93 additions and 52 deletions

View File

@@ -22,28 +22,19 @@ class LoggerTest extends \PHPUnit_Framework_TestCase
->method('handle');
$logger->pushHandler($handler);
$logger->addWarning('test');
$this->assertTrue($logger->addWarning('test'));
}
/**
* @dataProvider logValues
*/
public function testLogUntilHandled($bubble)
public function testLogNoHandler()
{
$logger = new Logger(__METHOD__);
$bottomHandler = $this->getMock('Monolog\Handler\NullHandler', array('handle'));
$bottomHandler->expects($bubble ? $this->once() : $this->never())
$handler = $this->getMock('Monolog\Handler\NullHandler', array('handle'), array(Logger::ERROR));
$handler->expects($this->never())
->method('handle');
$logger->pushHandler($bottomHandler);
$logger->pushHandler($handler);
$topHandler = $this->getMock('Monolog\Handler\NullHandler', array('handle'));
$topHandler->expects($this->once())
->method('handle')
->will($this->returnValue(!$bubble));
$logger->pushHandler($topHandler);
$logger->addWarning('test');
$this->assertFalse($logger->addWarning('test'));
}
public function logValues()