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