diff --git a/tests/Monolog/Handler/BufferHandlerTest.php b/tests/Monolog/Handler/BufferHandlerTest.php index 6fa5e4e6..dca29d1d 100644 --- a/tests/Monolog/Handler/BufferHandlerTest.php +++ b/tests/Monolog/Handler/BufferHandlerTest.php @@ -16,6 +16,11 @@ use Monolog\Logger; class BufferHandlerTest extends TestCase { + /** + * @covers Monolog\Handler\BufferHandler::__construct + * @covers Monolog\Handler\BufferHandler::handle + * @covers Monolog\Handler\BufferHandler::close + */ public function testHandleBuffers() { $test = new TestHandler(); @@ -29,6 +34,9 @@ class BufferHandlerTest extends TestCase $this->assertTrue(count($test->getRecords()) === 2); } + /** + * @covers Monolog\Handler\BufferHandler::close + */ public function testDestructPropagatesRecords() { $test = new TestHandler(); @@ -40,6 +48,9 @@ class BufferHandlerTest extends TestCase $this->assertTrue($test->hasDebugRecords()); } + /** + * @covers Monolog\Handler\BufferHandler::handle + */ public function testHandleBufferLimit() { $test = new TestHandler(); @@ -54,6 +65,9 @@ class BufferHandlerTest extends TestCase $this->assertFalse($test->hasDebugRecords()); } + /** + * @covers Monolog\Handler\BufferHandler::handle + */ public function testHandleLevel() { $test = new TestHandler(); diff --git a/tests/Monolog/Handler/FingersCrossedHandlerTest.php b/tests/Monolog/Handler/FingersCrossedHandlerTest.php index 747c2740..a26ebb06 100644 --- a/tests/Monolog/Handler/FingersCrossedHandlerTest.php +++ b/tests/Monolog/Handler/FingersCrossedHandlerTest.php @@ -16,6 +16,10 @@ use Monolog\Logger; class FingersCrossedHandlerTest extends TestCase { + /** + * @covers Monolog\Handler\FingersCrossedHandler::__construct + * @covers Monolog\Handler\FingersCrossedHandler::handle + */ public function testHandleBuffers() { $test = new TestHandler(); @@ -29,6 +33,9 @@ class FingersCrossedHandlerTest extends TestCase $this->assertTrue(count($test->getRecords()) === 3); } + /** + * @covers Monolog\Handler\FingersCrossedHandler::handle + */ public function testHandleStopsBufferingAfterTrigger() { $test = new TestHandler(); @@ -39,6 +46,10 @@ class FingersCrossedHandlerTest extends TestCase $this->assertTrue($test->hasDebugRecords()); } + /** + * @covers Monolog\Handler\FingersCrossedHandler::handle + * @covers Monolog\Handler\FingersCrossedHandler::reset + */ public function testHandleRestartBufferingAfterReset() { $test = new TestHandler(); @@ -52,7 +63,10 @@ class FingersCrossedHandlerTest extends TestCase $this->assertFalse($test->hasInfoRecords()); } - public function testHandleRestartBufferingAfterBeingTriggered() + /** + * @covers Monolog\Handler\FingersCrossedHandler::handle + */ + public function testHandleRestartBufferingAfterBeingTriggeredWhenStopBufferingIsDisabled() { $test = new TestHandler(); $handler = new FingersCrossedHandler($test, Logger::WARNING, 0, false, false); @@ -64,6 +78,9 @@ class FingersCrossedHandlerTest extends TestCase $this->assertFalse($test->hasInfoRecords()); } + /** + * @covers Monolog\Handler\FingersCrossedHandler::handle + */ public function testHandleBufferLimit() { $test = new TestHandler(); @@ -77,6 +94,9 @@ class FingersCrossedHandlerTest extends TestCase $this->assertFalse($test->hasDebugRecords()); } + /** + * @covers Monolog\Handler\FingersCrossedHandler::handle + */ public function testHandleWithCallback() { $test = new TestHandler(); @@ -93,6 +113,7 @@ class FingersCrossedHandlerTest extends TestCase } /** + * @covers Monolog\Handler\FingersCrossedHandler::handle * @expectedException RuntimeException */ public function testHandleWithBadCallbackThrowsException() @@ -102,4 +123,14 @@ class FingersCrossedHandlerTest extends TestCase }); $handler->handle($this->getRecord(Logger::WARNING)); } + + /** + * @covers Monolog\Handler\FingersCrossedHandler::isHandling + */ + public function testIsHandlingAlways() + { + $test = new TestHandler(); + $handler = new FingersCrossedHandler($test, Logger::ERROR); + $this->assertTrue($handler->isHandling($this->getRecord(Logger::DEBUG))); + } } diff --git a/tests/Monolog/Handler/FirePHPHandlerTest.php b/tests/Monolog/Handler/FirePHPHandlerTest.php index dca97497..fc4f1dea 100644 --- a/tests/Monolog/Handler/FirePHPHandlerTest.php +++ b/tests/Monolog/Handler/FirePHPHandlerTest.php @@ -14,6 +14,9 @@ namespace Monolog\Handler; use Monolog\TestCase; use Monolog\Logger; +/** + * @covers Monolog\Handler\FirePHPHandler + */ class FirePHPHandlerTest extends TestCase { public function setUp() diff --git a/tests/Monolog/Handler/GroupHandlerTest.php b/tests/Monolog/Handler/GroupHandlerTest.php index 0eae4060..44d77a5b 100644 --- a/tests/Monolog/Handler/GroupHandlerTest.php +++ b/tests/Monolog/Handler/GroupHandlerTest.php @@ -16,6 +16,19 @@ use Monolog\Logger; class GroupHandlerTest extends TestCase { + /** + * @covers Monolog\Handler\GroupHandler::__construct + * @expectedException InvalidArgumentException + */ + public function testConstructorOnlyTakesHandler() + { + new GroupHandler(array(new TestHandler(), "foo")); + } + + /** + * @covers Monolog\Handler\GroupHandler::__construct + * @covers Monolog\Handler\GroupHandler::handle + */ public function testHandle() { $testHandlers = array(new TestHandler(), new TestHandler()); @@ -29,6 +42,9 @@ class GroupHandlerTest extends TestCase } } + /** + * @covers Monolog\Handler\GroupHandler::handleBatch + */ public function testHandleBatch() { $testHandlers = array(new TestHandler(), new TestHandler()); @@ -40,4 +56,16 @@ class GroupHandlerTest extends TestCase $this->assertTrue(count($test->getRecords()) === 2); } } + + /** + * @covers Monolog\Handler\GroupHandler::isHandling + */ + public function testIsHandling() + { + $testHandlers = array(new TestHandler(Logger::ERROR), new TestHandler(Logger::WARNING)); + $handler = new GroupHandler($testHandlers); + $this->assertTrue($handler->isHandling($this->getRecord(Logger::ERROR))); + $this->assertTrue($handler->isHandling($this->getRecord(Logger::WARNING))); + $this->assertFalse($handler->isHandling($this->getRecord(Logger::DEBUG))); + } } diff --git a/tests/Monolog/Handler/MailHandlerTest.php b/tests/Monolog/Handler/MailHandlerTest.php index 6b8f96be..5ed3c1e4 100644 --- a/tests/Monolog/Handler/MailHandlerTest.php +++ b/tests/Monolog/Handler/MailHandlerTest.php @@ -16,6 +16,9 @@ use Monolog\TestCase; class MailHandlerTest extends TestCase { + /** + * @covers Monolog\Handler\MailHandler::handleBatch + */ public function testHandleBatch() { $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface'); @@ -33,6 +36,9 @@ class MailHandlerTest extends TestCase $handler->handleBatch($this->getMultipleRecords()); } + /** + * @covers Monolog\Handler\MailHandler::handleBatch + */ public function testHandleBatchNotSendsMailIfMessagesAreBelowLevel() { $records = array( @@ -49,6 +55,9 @@ class MailHandlerTest extends TestCase $handler->handleBatch($records); } + /** + * @covers Monolog\Handler\MailHandler::write + */ public function testHandle() { $handler = $this->getMockForAbstractClass('Monolog\\Handler\\MailHandler'); @@ -57,5 +66,4 @@ class MailHandlerTest extends TestCase $handler->handle($this->getRecord()); } - } \ No newline at end of file diff --git a/tests/Monolog/Handler/NullHandlerTest.php b/tests/Monolog/Handler/NullHandlerTest.php index b105cfef..12d13164 100644 --- a/tests/Monolog/Handler/NullHandlerTest.php +++ b/tests/Monolog/Handler/NullHandlerTest.php @@ -14,6 +14,9 @@ namespace Monolog\Handler; use Monolog\TestCase; use Monolog\Logger; +/** + * @covers Monolog\Handler\NullHandler::handle + */ class NullHandlerTest extends TestCase { public function testHandle() diff --git a/tests/Monolog/Handler/RotatingFileHandlerTest.php b/tests/Monolog/Handler/RotatingFileHandlerTest.php index fc9819e9..790f2161 100644 --- a/tests/Monolog/Handler/RotatingFileHandlerTest.php +++ b/tests/Monolog/Handler/RotatingFileHandlerTest.php @@ -14,6 +14,9 @@ namespace Monolog\Handler; use Monolog\TestCase; use Monolog\Logger; +/** + * @covers Monolog\Handler\RotatingFileHandler + */ class RotatingFileHandlerTest extends TestCase { public function setUp() diff --git a/tests/Monolog/Handler/StreamHandlerTest.php b/tests/Monolog/Handler/StreamHandlerTest.php index 296d8cdf..6f7cbec1 100644 --- a/tests/Monolog/Handler/StreamHandlerTest.php +++ b/tests/Monolog/Handler/StreamHandlerTest.php @@ -16,7 +16,11 @@ use Monolog\Logger; class StreamHandlerTest extends TestCase { - public function testHandle() + /** + * @covers Monolog\Handler\StreamHandler::__construct + * @covers Monolog\Handler\StreamHandler::write + */ + public function testWrite() { $handle = fopen('php://memory', 'a+'); $handler = new StreamHandler($handle); @@ -28,6 +32,9 @@ class StreamHandlerTest extends TestCase $this->assertEquals('testtest2test3', fread($handle, 100)); } + /** + * @covers Monolog\Handler\StreamHandler::close + */ public function testClose() { $handle = fopen('php://memory', 'a+'); @@ -37,7 +44,10 @@ class StreamHandlerTest extends TestCase $this->assertFalse(is_resource($handle)); } - public function testHandleCreatesTheStreamResource() + /** + * @covers Monolog\Handler\StreamHandler::write + */ + public function testWriteCreatesTheStreamResource() { $handler = new StreamHandler('php://memory'); $handler->handle($this->getRecord()); @@ -45,8 +55,10 @@ class StreamHandlerTest extends TestCase /** * @expectedException LogicException + * @covers Monolog\Handler\StreamHandler::__construct + * @covers Monolog\Handler\StreamHandler::write */ - public function testHandleMissingResource() + public function testWriteMissingResource() { $handler = new StreamHandler(null); $handler->handle($this->getRecord()); @@ -54,8 +66,10 @@ class StreamHandlerTest extends TestCase /** * @expectedException UnexpectedValueException + * @covers Monolog\Handler\StreamHandler::__construct + * @covers Monolog\Handler\StreamHandler::write */ - public function testHandleInvalidResource() + public function testWriteInvalidResource() { $handler = new StreamHandler('bogus://url'); $handler->handle($this->getRecord()); diff --git a/tests/Monolog/Handler/SyslogHandlerTest.php b/tests/Monolog/Handler/SyslogHandlerTest.php index 6c11f4e3..b2382f47 100644 --- a/tests/Monolog/Handler/SyslogHandlerTest.php +++ b/tests/Monolog/Handler/SyslogHandlerTest.php @@ -15,6 +15,9 @@ use Monolog\Logger; class SyslogHandlerTest extends \PHPUnit_Framework_TestCase { + /** + * @covers Monolog\Handler\SyslogHandler::__construct + */ public function testConstruct() { $handler = new SyslogHandler('test'); @@ -27,6 +30,9 @@ class SyslogHandlerTest extends \PHPUnit_Framework_TestCase $this->assertInstanceOf('Monolog\Handler\SyslogHandler', $handler); } + /** + * @covers Monolog\Handler\SyslogHandler::__construct + */ public function testConstructInvalidFacility() { $this->setExpectedException('UnexpectedValueException');