mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-06 05:07:36 +02:00
Merge remote-tracking branch 'francisbesset/feat-soapfault' into 1.x
This commit is contained in:
@@ -127,6 +127,20 @@ class NormalizerFormatter implements FormatterInterface
|
|||||||
'file' => $e->getFile().':'.$e->getLine(),
|
'file' => $e->getFile().':'.$e->getLine(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ($e instanceof \SoapFault) {
|
||||||
|
if (isset($e->faultcode)) {
|
||||||
|
$data['faultcode'] = $e->faultcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($e->faultactor)) {
|
||||||
|
$data['faultactor'] = $e->faultactor;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($e->detail)) {
|
||||||
|
$data['detail'] = $e->detail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$trace = $e->getTrace();
|
$trace = $e->getTrace();
|
||||||
foreach ($trace as $frame) {
|
foreach ($trace as $frame) {
|
||||||
if (isset($frame['file'])) {
|
if (isset($frame['file'])) {
|
||||||
|
@@ -85,6 +85,29 @@ class NormalizerFormatterTest extends \PHPUnit_Framework_TestCase
|
|||||||
), $formatted);
|
), $formatted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testFormatSoapFaultException()
|
||||||
|
{
|
||||||
|
$formatter = new NormalizerFormatter('Y-m-d');
|
||||||
|
$e = new \SoapFault('foo', 'bar', 'hello', 'world');
|
||||||
|
$formatted = $formatter->format(array(
|
||||||
|
'exception' => $e,
|
||||||
|
));
|
||||||
|
|
||||||
|
unset($formatted['exception']['trace']);
|
||||||
|
|
||||||
|
$this->assertEquals(array(
|
||||||
|
'exception' => array(
|
||||||
|
'class' => 'SoapFault',
|
||||||
|
'message' => 'bar',
|
||||||
|
'code' => 0,
|
||||||
|
'file' => $e->getFile().':'.$e->getLine(),
|
||||||
|
'faultcode' => 'foo',
|
||||||
|
'faultactor' => 'hello',
|
||||||
|
'detail' => 'world',
|
||||||
|
),
|
||||||
|
), $formatted);
|
||||||
|
}
|
||||||
|
|
||||||
public function testFormatToStringExceptionHandle()
|
public function testFormatToStringExceptionHandle()
|
||||||
{
|
{
|
||||||
$formatter = new NormalizerFormatter('Y-m-d');
|
$formatter = new NormalizerFormatter('Y-m-d');
|
||||||
|
Reference in New Issue
Block a user