Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
logKernelException example
$this
->
assertSame
(
'foo',
$_controller
->
getValue
(
$l
)
)
;
}
/** * @dataProvider provider */
public
function
testHandleWithoutLogger
(
$event
,
$event2
)
{
$this
->
iniSet
(
'error_log',
file_exists
(
'/dev/null'
)
? '/dev/null' : 'nul'
)
;
$l
=
new
ErrorListener
(
'foo'
)
;
$l
->
logKernelException
(
$event
)
;
$l
->
onKernelException
(
$event
)
;
$this
->
assertEquals
(
new
Response
(
'foo'
)
,
$event
->
getResponse
(
)
)
;
try
{
$l
->
logKernelException
(
$event2
)
;
$l
->
onKernelException
(
$event2
)
;
$this
->
fail
(
'RuntimeException expected'
)
;
}
catch
(
\RuntimeException
$e
)
{
$this
->
assertSame
(
'bar',
$e
->
getMessage
(
)
)
;
$this
->
assertSame
(
'foo',
$e
->
getPrevious
(
)
->
getMessage
(
)
)
;
}