diff options
Diffstat (limited to 'tests/Monolog/Handler/AbstractHandlerTest.php')
-rw-r--r-- | tests/Monolog/Handler/AbstractHandlerTest.php | 58 |
1 files changed, 6 insertions, 52 deletions
diff --git a/tests/Monolog/Handler/AbstractHandlerTest.php b/tests/Monolog/Handler/AbstractHandlerTest.php index 568eb9d..b7451a7 100644 --- a/tests/Monolog/Handler/AbstractHandlerTest.php +++ b/tests/Monolog/Handler/AbstractHandlerTest.php @@ -1,4 +1,4 @@ -<?php +<?php declare(strict_types=1); /* * This file is part of the Monolog package. @@ -11,10 +11,8 @@ namespace Monolog\Handler; -use Monolog\TestCase; +use Monolog\Test\TestCase; use Monolog\Logger; -use Monolog\Formatter\LineFormatter; -use Monolog\Processor\WebProcessor; class AbstractHandlerTest extends TestCase { @@ -24,21 +22,17 @@ class AbstractHandlerTest extends TestCase * @covers Monolog\Handler\AbstractHandler::setLevel * @covers Monolog\Handler\AbstractHandler::getBubble * @covers Monolog\Handler\AbstractHandler::setBubble - * @covers Monolog\Handler\AbstractHandler::getFormatter - * @covers Monolog\Handler\AbstractHandler::setFormatter */ public function testConstructAndGetSet() { - $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler', array(Logger::WARNING, false)); + $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler', [Logger::WARNING, false]); $this->assertEquals(Logger::WARNING, $handler->getLevel()); $this->assertEquals(false, $handler->getBubble()); $handler->setLevel(Logger::ERROR); $handler->setBubble(true); - $handler->setFormatter($formatter = new LineFormatter); $this->assertEquals(Logger::ERROR, $handler->getLevel()); $this->assertEquals(true, $handler->getBubble()); - $this->assertSame($formatter, $handler->getFormatter()); } /** @@ -49,7 +43,7 @@ class AbstractHandlerTest extends TestCase $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler'); $handler->expects($this->exactly(2)) ->method('handle'); - $handler->handleBatch(array($this->getRecord(), $this->getRecord())); + $handler->handleBatch([$this->getRecord(), $this->getRecord()]); } /** @@ -57,7 +51,7 @@ class AbstractHandlerTest extends TestCase */ public function testIsHandling() { - $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler', array(Logger::WARNING, false)); + $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler', [Logger::WARNING, false]); $this->assertTrue($handler->isHandling($this->getRecord())); $this->assertFalse($handler->isHandling($this->getRecord(Logger::DEBUG))); } @@ -67,49 +61,9 @@ class AbstractHandlerTest extends TestCase */ public function testHandlesPsrStyleLevels() { - $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler', array('warning', false)); + $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler', ['warning', false]); $this->assertFalse($handler->isHandling($this->getRecord(Logger::DEBUG))); $handler->setLevel('debug'); $this->assertTrue($handler->isHandling($this->getRecord(Logger::DEBUG))); } - - /** - * @covers Monolog\Handler\AbstractHandler::getFormatter - * @covers Monolog\Handler\AbstractHandler::getDefaultFormatter - */ - public function testGetFormatterInitializesDefault() - { - $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler'); - $this->assertInstanceOf('Monolog\Formatter\LineFormatter', $handler->getFormatter()); - } - - /** - * @covers Monolog\Handler\AbstractHandler::pushProcessor - * @covers Monolog\Handler\AbstractHandler::popProcessor - * @expectedException LogicException - */ - public function testPushPopProcessor() - { - $logger = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler'); - $processor1 = new WebProcessor; - $processor2 = new WebProcessor; - - $logger->pushProcessor($processor1); - $logger->pushProcessor($processor2); - - $this->assertEquals($processor2, $logger->popProcessor()); - $this->assertEquals($processor1, $logger->popProcessor()); - $logger->popProcessor(); - } - - /** - * @covers Monolog\Handler\AbstractHandler::pushProcessor - * @expectedException InvalidArgumentException - */ - public function testPushProcessorWithNonCallable() - { - $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler'); - - $handler->pushProcessor(new \stdClass()); - } } |