mirror of
https://github.com/Seldaek/monolog.git
synced 2025-07-31 18:30:15 +02:00
Added @covers annotations to everything
This commit is contained in:
@@ -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();
|
||||
|
@@ -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)));
|
||||
}
|
||||
}
|
||||
|
@@ -14,6 +14,9 @@ namespace Monolog\Handler;
|
||||
use Monolog\TestCase;
|
||||
use Monolog\Logger;
|
||||
|
||||
/**
|
||||
* @covers Monolog\Handler\FirePHPHandler
|
||||
*/
|
||||
class FirePHPHandlerTest extends TestCase
|
||||
{
|
||||
public function setUp()
|
||||
|
@@ -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)));
|
||||
}
|
||||
}
|
||||
|
@@ -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());
|
||||
}
|
||||
|
||||
}
|
@@ -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()
|
||||
|
@@ -14,6 +14,9 @@ namespace Monolog\Handler;
|
||||
use Monolog\TestCase;
|
||||
use Monolog\Logger;
|
||||
|
||||
/**
|
||||
* @covers Monolog\Handler\RotatingFileHandler
|
||||
*/
|
||||
class RotatingFileHandlerTest extends TestCase
|
||||
{
|
||||
public function setUp()
|
||||
|
@@ -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());
|
||||
|
@@ -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');
|
||||
|
Reference in New Issue
Block a user