Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
beforeWriteOrderItems example
$stockSubscriber
=
new
OrderStockSubscriber
(
$this
->
createMock
(
Connection::
class
)
,
$stockStorage
,
false
)
;
$event
= EntityWriteEvent::
create
(
WriteContext::
createFromContext
(
$context
)
,
[
]
,
)
;
$stockSubscriber
->
beforeWriteOrderItems
(
$event
)
;
$event
->
success
(
)
;
}
public
function
testBeforeWriteOnlyReactsToLiveVersions
(
)
: void
{
$context
= Context::
createDefaultContext
(
)
->
createWithVersionId
(
$this
->ids->
create
(
'version'
)
)
;
$stockStorage
=
$this
->
createMock
(
StockStorage::
class
)
;
$stockStorage
->
expects
(
static
::
never
(
)
)
->
method
(
'alter'
)
;
$stockSubscriber
=
new
OrderStockSubscriber
(