From e0b521ba53b375421c41e63544b5e85d0a670f09 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Thu, 14 Apr 2016 17:02:29 -0400 Subject: [PATCH] Add a test that verifies manual overriding of activation strategy works --- .../Handler/FingersCrossedHandlerTest.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/Monolog/Handler/FingersCrossedHandlerTest.php b/tests/Monolog/Handler/FingersCrossedHandlerTest.php index 8e31e9b8..f87c632e 100644 --- a/tests/Monolog/Handler/FingersCrossedHandlerTest.php +++ b/tests/Monolog/Handler/FingersCrossedHandlerTest.php @@ -173,6 +173,22 @@ class FingersCrossedHandlerTest extends TestCase $this->assertTrue($test->hasWarningRecords()); } + /** + * @covers Monolog\Handler\FingersCrossedHandler::__construct + * @covers Monolog\Handler\FingersCrossedHandler::activate + */ + public function testOverrideActivationStrategy() + { + $test = new TestHandler(); + $handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy('warning')); + $handler->handle($this->getRecord(Logger::DEBUG)); + $this->assertFalse($test->hasDebugRecords()); + $handler->activate(); + $handler->handle($this->getRecord(Logger::INFO)); + $this->assertTrue($test->hasDebugRecords()); + $this->assertTrue($test->hasInfoRecords()); + } + /** * @covers Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy::__construct * @covers Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy::isHandlerActivated