Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
logFlowEvent example
$connection
=
$this
->
getContainer
(
)
->
get
(
Connection::
class
)
;
$connection
->
executeStatement
(
'DELETE FROM `log_entry`'
)
;
}
public
function
testWriteFlowEvents
(
)
: void
{
$handler
=
new
TestHandler
(
)
;
$logger
=
new
Logger
(
'testlogger',
[
$handler
]
)
;
$service
=
new
LoggingService
(
'test',
$logger
)
;
$service
->
logFlowEvent
(
new
FlowLogEvent
(
TestFlowBusinessEvent::EVENT_NAME,
new
TestFlowBusinessEvent
(
$this
->context
)
)
)
;
$records
=
$handler
->
getRecords
(
)
;
static
::
assertCount
(
1,
$records
)
;
$testRecord
=
$records
[
0
]
;
static
::
assertEquals
(
TestFlowBusinessEvent::EVENT_NAME,
$testRecord
->message
)
;
static
::
assertEquals
(
'test',
$testRecord
->context
[
'environment'
]
)
;
static
::
assertEquals
(
Level::Debug,
$testRecord
->level
)
;