MonologHandlerAbstractProcessingHandlerTest

The Gravity PDF Monolog Handler AbstractProcessingHandlerTest class.

Defined (1)

The class is defined in the following location(s).

/vendor/monolog/monolog/tests/Monolog/Handler/AbstractProcessingHandlerTest.php  
  1. class AbstractProcessingHandlerTest extends TestCase 
  2. /** 
  3. * @covers Monolog\Handler\AbstractProcessingHandler::handle 
  4. */ 
  5. public function testHandleLowerLevelMessage() 
  6. $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractProcessingHandler', array(Logger::WARNING, true)); 
  7. $this->assertFalse($handler->handle($this->getRecord(Logger::DEBUG))); 
  8.  
  9. /** 
  10. * @covers Monolog\Handler\AbstractProcessingHandler::handle 
  11. */ 
  12. public function testHandleBubbling() 
  13. $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractProcessingHandler', array(Logger::DEBUG, true)); 
  14. $this->assertFalse($handler->handle($this->getRecord())); 
  15.  
  16. /** 
  17. * @covers Monolog\Handler\AbstractProcessingHandler::handle 
  18. */ 
  19. public function testHandleNotBubbling() 
  20. $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractProcessingHandler', array(Logger::DEBUG, false)); 
  21. $this->assertTrue($handler->handle($this->getRecord())); 
  22.  
  23. /** 
  24. * @covers Monolog\Handler\AbstractProcessingHandler::handle 
  25. */ 
  26. public function testHandleIsFalseWhenNotHandled() 
  27. $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractProcessingHandler', array(Logger::WARNING, false)); 
  28. $this->assertTrue($handler->handle($this->getRecord())); 
  29. $this->assertFalse($handler->handle($this->getRecord(Logger::DEBUG))); 
  30.  
  31. /** 
  32. * @covers Monolog\Handler\AbstractProcessingHandler::processRecord 
  33. */ 
  34. public function testProcessRecord() 
  35. $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractProcessingHandler'); 
  36. $handler->pushProcessor(new WebProcessor(array( 
  37. 'REQUEST_URI' => '',  
  38. 'REQUEST_METHOD' => '',  
  39. 'REMOTE_ADDR' => '',  
  40. 'SERVER_NAME' => '',  
  41. 'UNIQUE_ID' => '',  
  42. ))); 
  43. $handledRecord = null; 
  44. $handler->expects($this->once()) 
  45. ->method('write') 
  46. ->will($this->returnCallback(function ($record) use (&$handledRecord) { 
  47. $handledRecord = $record; 
  48. })) 
  49. $handler->handle($this->getRecord()); 
  50. $this->assertEquals(6, count($handledRecord['extra']));