Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
onCustomerWritten example
public
function
testOnCustomerWrittenWithInstanceOfSaleChannelApi
(
)
: void
{
$context
= Context::
createDefaultContext
(
new
SalesChannelApiSource
(
Defaults::SALES_CHANNEL_TYPE_API
)
)
;
$event
=
$this
->
createMock
(
EntityWrittenEvent::
class
)
;
$event
->
expects
(
static
::
once
(
)
)
->
method
(
'getContext'
)
->
willReturn
(
$context
)
;
$this
->customerFlowEventsSubscriber->
onCustomerWritten
(
$event
)
;
}
public
function
testOnCustomerUpdateWithoutCustomerInContext
(
)
: void
{
$event
=
$this
->
createMock
(
EntityWrittenEvent::
class
)
;
$event
->
expects
(
static
::
exactly
(
2
)
)
->
method
(
'getContext'
)
->
willReturn
(
Context::
createDefaultContext
(
)
)
;
$payloads
=
[
[