mirror of
https://github.com/Seldaek/monolog.git
synced 2025-10-21 16:46:11 +02:00
Make TestHandler::hasRecord assert context, not only message
This commit is contained in:
committed by
Jordi Boggiano
parent
e8db808dd3
commit
b381a973bc
@@ -86,12 +86,20 @@ class TestHandler extends AbstractProcessingHandler
|
||||
|
||||
public function hasRecord($record, $level)
|
||||
{
|
||||
if (is_array($record)) {
|
||||
$record = $record['message'];
|
||||
}
|
||||
|
||||
return $this->hasRecordThatPasses(function ($rec) use ($record) {
|
||||
return $rec['message'] === $record;
|
||||
if (is_array($record)) {
|
||||
if ($rec['message'] !== $record['message']) {
|
||||
return false;
|
||||
}
|
||||
if ($rec['context'] !== $record['context']) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if ($rec['message'] !== $record) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}, $level);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user