|
|
@@ -156,6 +156,22 @@ class FingersCrossedHandlerTest extends TestCase
|
|
|
$this->assertTrue($test->hasWarningRecords());
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @covers Monolog\Handler\FingersCrossedHandler::__construct
|
|
|
+ * @covers Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy::__construct
|
|
|
+ * @covers Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy::isHandlerActivated
|
|
|
+ */
|
|
|
+ public function testErrorLevelActivationStrategyWithPsrLevel()
|
|
|
+ {
|
|
|
+ $test = new TestHandler();
|
|
|
+ $handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy('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());
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @covers Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy::__construct
|
|
|
* @covers Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy::isHandlerActivated
|
|
|
@@ -173,6 +189,23 @@ class FingersCrossedHandlerTest extends TestCase
|
|
|
$this->assertTrue($test->hasWarningRecords());
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @covers Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy::__construct
|
|
|
+ * @covers Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy::isHandlerActivated
|
|
|
+ */
|
|
|
+ public function testChannelLevelActivationStrategyWithPsrLevels()
|
|
|
+ {
|
|
|
+ $test = new TestHandler();
|
|
|
+ $handler = new FingersCrossedHandler($test, new ChannelLevelActivationStrategy('error', array('othertest' => 'debug')));
|
|
|
+ $handler->handle($this->getRecord(Logger::WARNING));
|
|
|
+ $this->assertFalse($test->hasWarningRecords());
|
|
|
+ $record = $this->getRecord(Logger::DEBUG);
|
|
|
+ $record['channel'] = 'othertest';
|
|
|
+ $handler->handle($record);
|
|
|
+ $this->assertTrue($test->hasDebugRecords());
|
|
|
+ $this->assertTrue($test->hasWarningRecords());
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @covers Monolog\Handler\FingersCrossedHandler::handle
|
|
|
*/
|