1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-08 22:26:41 +02:00

Merge branch '1.x'

This commit is contained in:
Jordi Boggiano
2020-05-21 16:59:46 +02:00
6 changed files with 82 additions and 5 deletions

View File

@@ -87,7 +87,7 @@ class NormalizerFormatterTest extends TestCase
}
$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([
'exception' => $e,
]);
@@ -105,6 +105,26 @@ class NormalizerFormatterTest extends TestCase
'detail' => 'world',
],
], $formatted);
$formatter = new NormalizerFormatter('Y-m-d');
$e = new \SoapFault('foo', 'bar', 'hello', (object) array('bar' => (object) array('biz' => 'baz'), 'foo' => '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' => '{"bar":{"biz":"baz"},"foo":"world"}',
),
), $formatted);
}
public function testFormatToStringExceptionHandle()

View File

@@ -13,6 +13,29 @@ namespace Monolog;
class UtilsTest extends \PHPUnit_Framework_TestCase
{
/**
* @param string $expected
* @param string $input
* @dataProvider providePathsToCanonicalize
*/
public function testCanonicalizePath($expected, $input)
{
$this->assertSame($expected, Utils::canonicalizePath($input));
}
public function providePathsToCanonicalize()
{
return array(
array('/foo/bar', '/foo/bar'),
array('file://'.getcwd().'/bla', 'file://bla'),
array(getcwd().'/bla', 'bla'),
array(getcwd().'/./bla', './bla'),
array('file:///foo/bar', 'file:///foo/bar'),
array('any://foo', 'any://foo'),
array('\\\\network\path', '\\\\network\path'),
);
}
/**
* @param int $code
* @param string $msg