/**
  * @expectedException RuntimeException
  */
 public function testHandleWithBadCallbackThrowsException()
 {
     $handler = new FingersCrossedHandler(function ($record, $handler) {
         return 'foo';
     });
     $handler->handle($this->getRecord(Logger::WARNING));
 }
 /**
  * @covers Monolog\Handler\FingersCrossedHandler::close
  */
 public function testPsrLevelPassthruOnClose()
 {
     $test = new TestHandler();
     $handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy(Logger::WARNING), 0, true, true, LogLevel::INFO);
     $handler->handle($this->getRecord(Logger::DEBUG));
     $handler->handle($this->getRecord(Logger::INFO));
     $handler->close();
     $this->assertFalse($test->hasDebugRecords());
     $this->assertTrue($test->hasInfoRecords());
 }
 /**
  * @covers Monolog\Handler\FingersCrossedHandler::handle
  */
 public function testHandleUsesProcessors()
 {
     $test = new TestHandler();
     $handler = new FingersCrossedHandler($test, Logger::INFO);
     $handler->pushProcessor(function ($record) {
         $record['extra']['foo'] = true;
         return $record;
     });
     $handler->handle($this->getRecord(Logger::WARNING));
     $this->assertTrue($test->hasWarningRecords());
     $records = $test->getRecords();
     $this->assertTrue($records[0]['extra']['foo']);
 }
 /**
  * @covers Monolog\Handler\FingersCrossedHandler::__construct
  */
 public function testActivationStrategy()
 {
     $test = new TestHandler();
     $handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy(Logger::WARNING));
     $handler->handle($this->getRecord(Logger::DEBUG));
     $this->assertFalse($test->hasDebugRecords());
     $handler->handle($this->getRecord(Logger::WARNING));
     $this->assertTrue($test->hasDebugRecords());
     $this->assertTrue($test->hasWarningRecords());
 }