1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-01 10:50:21 +02:00

Merge branch '2.x'

This commit is contained in:
Jordi Boggiano
2022-07-22 20:49:57 +02:00
2 changed files with 21 additions and 1 deletions

View File

@@ -48,6 +48,15 @@ abstract class Handler implements HandlerInterface
{
$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;
}
}

View File

@@ -30,4 +30,15 @@ class NullHandlerTest extends TestCase
$handler = new NullHandler(Level::Warning);
$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)));
}
}