mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-04 12:17:35 +02:00
Merge branch '2.x'
This commit is contained in:
@@ -48,6 +48,15 @@ abstract class Handler implements HandlerInterface
|
|||||||
{
|
{
|
||||||
$this->close();
|
$this->close();
|
||||||
|
|
||||||
return array_keys(get_object_vars($this));
|
$reflClass = new \ReflectionClass($this);
|
||||||
|
|
||||||
|
$keys = [];
|
||||||
|
foreach ($reflClass->getProperties() as $reflProp) {
|
||||||
|
if (!$reflProp->isStatic()) {
|
||||||
|
$keys[] = $reflProp->getName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $keys;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -30,4 +30,15 @@ class NullHandlerTest extends TestCase
|
|||||||
$handler = new NullHandler(Level::Warning);
|
$handler = new NullHandler(Level::Warning);
|
||||||
$this->assertFalse($handler->handle($this->getRecord(Level::Debug)));
|
$this->assertFalse($handler->handle($this->getRecord(Level::Debug)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testSerializeRestorePrivate()
|
||||||
|
{
|
||||||
|
$handler = new NullHandler(Logger::WARNING);
|
||||||
|
self::assertFalse($handler->handle($this->getRecord(Logger::DEBUG)));
|
||||||
|
self::assertTrue($handler->handle($this->getRecord(Logger::WARNING)));
|
||||||
|
|
||||||
|
$handler = unserialize(serialize($handler));
|
||||||
|
self::assertFalse($handler->handle($this->getRecord(Logger::DEBUG)));
|
||||||
|
self::assertTrue($handler->handle($this->getRecord(Logger::WARNING)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user