mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-04 12:17:35 +02:00
Assert SoapFail can handle a structured detail
This commit is contained in:
@@ -192,6 +192,19 @@ class LineFormatterTest extends \PHPUnit\Framework\TestCase
|
|||||||
$path = str_replace('\\/', '/', json_encode(__FILE__));
|
$path = str_replace('\\/', '/', json_encode(__FILE__));
|
||||||
|
|
||||||
$this->assertEquals('['.date('Y-m-d').'] core.CRITICAL: foobar {"exception":"[object] (SoapFault(code: 0 faultcode: foo faultactor: hello detail: world): bar at '.substr($path, 1, -1).':'.(__LINE__ - 8).')"} []'."\n", $message);
|
$this->assertEquals('['.date('Y-m-d').'] core.CRITICAL: foobar {"exception":"[object] (SoapFault(code: 0 faultcode: foo faultactor: hello detail: world): bar at '.substr($path, 1, -1).':'.(__LINE__ - 8).')"} []'."\n", $message);
|
||||||
|
|
||||||
|
$message = $formatter->format([
|
||||||
|
'level_name' => 'CRITICAL',
|
||||||
|
'channel' => 'core',
|
||||||
|
'context' => ['exception' => new \SoapFault('foo', 'bar', 'hello', (object) ['bar' => (object) ['biz' => 'baz'], 'foo' => 'world'])],
|
||||||
|
'datetime' => new \DateTimeImmutable,
|
||||||
|
'extra' => [],
|
||||||
|
'message' => 'foobar',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$path = str_replace('\\/', '/', json_encode(__FILE__));
|
||||||
|
|
||||||
|
$this->assertEquals('['.date('Y-m-d').'] core.CRITICAL: foobar {"exception":"[object] (SoapFault(code: 0 faultcode: foo faultactor: hello detail: {\"bar\":{\"biz\":\"baz\"},\"foo\":\"world\"}): bar at '.substr($path, 1, -1).':'.(__LINE__ - 8).')"} []'."\n", $message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testBatchFormat()
|
public function testBatchFormat()
|
||||||
|
@@ -87,7 +87,7 @@ class NormalizerFormatterTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
$formatter = new NormalizerFormatter('Y-m-d');
|
$formatter = new NormalizerFormatter('Y-m-d');
|
||||||
$e = new \SoapFault('foo', 'bar', 'hello', (object) ['foo' => 'world']);
|
$e = new \SoapFault('foo', 'bar', 'hello', 'world');
|
||||||
$formatted = $formatter->format([
|
$formatted = $formatter->format([
|
||||||
'exception' => $e,
|
'exception' => $e,
|
||||||
]);
|
]);
|
||||||
@@ -105,6 +105,26 @@ class NormalizerFormatterTest extends TestCase
|
|||||||
'detail' => 'world',
|
'detail' => 'world',
|
||||||
],
|
],
|
||||||
], $formatted);
|
], $formatted);
|
||||||
|
|
||||||
|
$formatter = new NormalizerFormatter('Y-m-d');
|
||||||
|
$e = new \SoapFault('foo', 'bar', 'hello', (object) ['bar' => (object) ['biz' => 'baz'], 'foo' => 'world']);
|
||||||
|
$formatted = $formatter->format([
|
||||||
|
'exception' => $e,
|
||||||
|
]);
|
||||||
|
|
||||||
|
unset($formatted['exception']['trace']);
|
||||||
|
|
||||||
|
$this->assertEquals([
|
||||||
|
'exception' => [
|
||||||
|
'class' => 'SoapFault',
|
||||||
|
'message' => 'bar',
|
||||||
|
'code' => 0,
|
||||||
|
'file' => $e->getFile().':'.$e->getLine(),
|
||||||
|
'faultcode' => 'foo',
|
||||||
|
'faultactor' => 'hello',
|
||||||
|
'detail' => '{"bar":{"biz":"baz"},"foo":"world"}',
|
||||||
|
],
|
||||||
|
], $formatted);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFormatToStringExceptionHandle()
|
public function testFormatToStringExceptionHandle()
|
||||||
|
Reference in New Issue
Block a user