AbstractHandlerTest.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 AbstractHandlerTest extends TestCase
  14. {
  15. public function testHandleLowerLevelMessage()
  16. {
  17. $handler = new TestHandler(Logger::WARNING, true);
  18. $this->assertFalse($handler->handle($this->getRecord(Logger::DEBUG)));
  19. }
  20. public function testHandleBubbling()
  21. {
  22. $handler = new TestHandler(Logger::DEBUG, true);
  23. $this->assertFalse($handler->handle($this->getRecord()));
  24. }
  25. public function testHandleNotBubbling()
  26. {
  27. $handler = new TestHandler(Logger::DEBUG, false);
  28. $this->assertTrue($handler->handle($this->getRecord()));
  29. }
  30. public function testIsHandling()
  31. {
  32. $handler = new TestHandler(Logger::WARNING, false);
  33. $this->assertTrue($handler->handle($this->getRecord()));
  34. $this->assertFalse($handler->handle($this->getRecord(Logger::DEBUG)));
  35. }
  36. }