|
|
@@ -29,7 +29,7 @@ class AbstractHandlerTest extends TestCase
|
|
|
*/
|
|
|
public function testConstructAndGetSet()
|
|
|
{
|
|
|
- $handler = new TestHandler(Logger::WARNING, false);
|
|
|
+ $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler', array(Logger::WARNING, false));
|
|
|
$this->assertEquals(Logger::WARNING, $handler->getLevel());
|
|
|
$this->assertEquals(false, $handler->getBubble());
|
|
|
|
|
|
@@ -38,7 +38,7 @@ class AbstractHandlerTest extends TestCase
|
|
|
$handler->setFormatter($formatter = new LineFormatter);
|
|
|
$this->assertEquals(Logger::ERROR, $handler->getLevel());
|
|
|
$this->assertEquals(true, $handler->getBubble());
|
|
|
- $this->assertEquals($formatter, $handler->getFormatter());
|
|
|
+ $this->assertSame($formatter, $handler->getFormatter());
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -46,9 +46,10 @@ class AbstractHandlerTest extends TestCase
|
|
|
*/
|
|
|
public function testHandleBatch()
|
|
|
{
|
|
|
- $handler = new TestHandler();
|
|
|
+ $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler');
|
|
|
+ $handler->expects($this->exactly(2))
|
|
|
+ ->method('handle');
|
|
|
$handler->handleBatch(array($this->getRecord(), $this->getRecord()));
|
|
|
- $this->assertEquals(2, count($handler->getRecords()));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -56,7 +57,7 @@ class AbstractHandlerTest extends TestCase
|
|
|
*/
|
|
|
public function testIsHandling()
|
|
|
{
|
|
|
- $handler = new TestHandler(Logger::WARNING, false);
|
|
|
+ $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler', array(Logger::WARNING, false));
|
|
|
$this->assertTrue($handler->isHandling($this->getRecord()));
|
|
|
$this->assertFalse($handler->isHandling($this->getRecord(Logger::DEBUG)));
|
|
|
}
|
|
|
@@ -67,7 +68,7 @@ class AbstractHandlerTest extends TestCase
|
|
|
*/
|
|
|
public function testGetFormatterInitializesDefault()
|
|
|
{
|
|
|
- $handler = new TestHandler();
|
|
|
+ $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler');
|
|
|
$this->assertInstanceOf('Monolog\Formatter\LineFormatter', $handler->getFormatter());
|
|
|
}
|
|
|
|
|
|
@@ -78,7 +79,7 @@ class AbstractHandlerTest extends TestCase
|
|
|
*/
|
|
|
public function testPushPopProcessor()
|
|
|
{
|
|
|
- $logger = new TestHandler();
|
|
|
+ $logger = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler');
|
|
|
$processor1 = new WebProcessor;
|
|
|
$processor2 = new WebProcessor;
|
|
|
|
|
|
@@ -90,4 +91,14 @@ class AbstractHandlerTest extends TestCase
|
|
|
$logger->popProcessor();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @covers Monolog\Handler\AbstractHandler::pushProcessor
|
|
|
+ * @expectedException InvalidArgumentException
|
|
|
+ */
|
|
|
+ public function testPushProcessorWithNonCallable()
|
|
|
+ {
|
|
|
+ $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler');
|
|
|
+
|
|
|
+ $handler->pushProcessor(new \stdClass());
|
|
|
+ }
|
|
|
}
|