mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-11 23:54:04 +02:00
Normalize the way backtraces are normalized and remove args for special cases, fixes #1346
This commit is contained in:
@@ -390,21 +390,12 @@ class NormalizerFormatterTest extends \PHPUnit_Framework_TestCase
|
||||
$record = array('context' => array('exception' => $e));
|
||||
$result = $formatter->format($record);
|
||||
|
||||
$this->assertRegExp(
|
||||
'%"resource":"\[resource\] \(stream\)"%',
|
||||
$result['context']['exception']['trace'][0]
|
||||
);
|
||||
|
||||
if (version_compare(PHP_VERSION, '5.5.0', '>=')) {
|
||||
$pattern = '%"wrappedResource":"\[object\] \(Monolog\\\\\\\\Formatter\\\\\\\\TestFooNorm: \)"%';
|
||||
} else {
|
||||
$pattern = '%\\\\"foo\\\\":null%';
|
||||
}
|
||||
|
||||
// Tests that the wrapped resource is ignored while encoding, only works for PHP <= 5.4
|
||||
$this->assertRegExp(
|
||||
$pattern,
|
||||
$result['context']['exception']['trace'][0]
|
||||
$this->assertSame(
|
||||
array(
|
||||
PHP_VERSION_ID < 50400 ? 'Monolog\Formatter\{closure}' : 'Monolog\Formatter\NormalizerFormatterTest->Monolog\Formatter\{closure}',
|
||||
__FILE__.':'.(__LINE__-12),
|
||||
),
|
||||
array_slice($result['context']['exception']['trace'], 0, 2)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -421,7 +412,7 @@ class NormalizerFormatterTest extends \PHPUnit_Framework_TestCase
|
||||
$result = $formatter->format($record);
|
||||
|
||||
$this->assertSame(
|
||||
'{"function":"throwHelper","class":"Monolog\\\\Formatter\\\\NormalizerFormatterTest","type":"->","args":["[object] (Monolog\\\\Formatter\\\\TestInfoLeak)","'.$dt->format('Y-m-d H:i:s').'"]}',
|
||||
'Monolog\\Formatter\\NormalizerFormatterTest->throwHelper',
|
||||
$result['context']['exception']['trace'][0]
|
||||
);
|
||||
}
|
||||
|
@@ -28,7 +28,7 @@ class ScalarFormatterTest extends \PHPUnit_Framework_TestCase
|
||||
if (isset($frame['file'])) {
|
||||
$data[] = $frame['file'].':'.$frame['line'];
|
||||
} else {
|
||||
$data[] = json_encode($frame);
|
||||
$data[] = (!empty($frame['class']) ? $frame['class'].$frame['type'] : '').$frame['function'];
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user