AbstractProcessingHandlerTest.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /*
  3. * This file is part of the Monolog package.
  4. *
  5. * (c) Jordi Boggiano <j.boggiano@seld.be>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Monolog\Handler;
  11. use Monolog\TestCase;
  12. use Monolog\Logger;
  13. class AbstractProcessingHandlerTest extends TestCase
  14. {
  15. /**
  16. * @covers Monolog\Handler\AbstractProcessingHandler::handle
  17. */
  18. public function testHandleLowerLevelMessage()
  19. {
  20. $handler = new TestHandler(Logger::WARNING, true);
  21. $this->assertFalse($handler->handle($this->getRecord(Logger::DEBUG)));
  22. }
  23. /**
  24. * @covers Monolog\Handler\AbstractProcessingHandler::handle
  25. */
  26. public function testHandleBubbling()
  27. {
  28. $handler = new TestHandler(Logger::DEBUG, true);
  29. $this->assertFalse($handler->handle($this->getRecord()));
  30. }
  31. /**
  32. * @covers Monolog\Handler\AbstractProcessingHandler::handle
  33. */
  34. public function testHandleNotBubbling()
  35. {
  36. $handler = new TestHandler(Logger::DEBUG, false);
  37. $this->assertTrue($handler->handle($this->getRecord()));
  38. }
  39. /**
  40. * @covers Monolog\Handler\AbstractProcessingHandler::handle
  41. */
  42. public function testHandleIsFalseWhenNotHandled()
  43. {
  44. $handler = new TestHandler(Logger::WARNING, false);
  45. $this->assertTrue($handler->handle($this->getRecord()));
  46. $this->assertFalse($handler->handle($this->getRecord(Logger::DEBUG)));
  47. }
  48. }