1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-11 23:54:04 +02:00

Merge branch '1.x'

This commit is contained in:
Jordi Boggiano
2018-06-18 15:52:19 +02:00
2 changed files with 55 additions and 3 deletions

View File

@@ -54,6 +54,52 @@ class TestHandlerTest extends TestCase
$this->assertEquals([$record], $records);
}
public function testHandlerAssertEmptyContext() {
$handler = new TestHandler;
$record = $this->getRecord(Logger::WARNING, 'test', []);
$this->assertFalse($handler->hasWarning([
'message' => 'test',
'context' => [],
]));
$handler->handle($record);
$this->assertTrue($handler->hasWarning([
'message' => 'test',
'context' => [],
]));
$this->assertFalse($handler->hasWarning([
'message' => 'test',
'context' => [
'foo' => 'bar'
],
]));
}
public function testHandlerAssertNonEmptyContext() {
$handler = new TestHandler;
$record = $this->getRecord(Logger::WARNING, 'test', ['foo' => 'bar']);
$this->assertFalse($handler->hasWarning([
'message' => 'test',
'context' => [
'foo' => 'bar'
],
]));
$handler->handle($record);
$this->assertTrue($handler->hasWarning([
'message' => 'test',
'context' => [
'foo' => 'bar'
],
]));
$this->assertFalse($handler->hasWarning([
'message' => 'test',
'context' => [],
]));
}
public function methodProvider()
{
return [