Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
SalesChannelContextAssembledEvent example
#[Package('checkout')]
class
SalesChannelContextAssembledEventTest
extends
TestCase
{
public
function
testConstruct
(
)
: void
{
$order
=
new
OrderEntity
(
)
;
$context
= Generator::
createSalesChannelContext
(
)
;
$event
=
new
SalesChannelContextAssembledEvent
(
$order
,
$context
)
;
static
::
assertSame
(
$order
,
$event
->
getOrder
(
)
)
;
static
::
assertSame
(
$context
->
getContext
(
)
,
$event
->
getContext
(
)
)
;
}
}
$salesChannelContext
->
setItemRounding
(
$order
->
getItemRounding
(
)
)
;
}
if
(
$order
->
getTotalRounding
(
)
!== null
)
{
$salesChannelContext
->
setTotalRounding
(
$order
->
getTotalRounding
(
)
)
;
}
if
(
$order
->
getRuleIds
(
)
!== null
)
{
$salesChannelContext
->
setRuleIds
(
$order
->
getRuleIds
(
)
)
;
}
$event
=
new
SalesChannelContextAssembledEvent
(
$order
,
$salesChannelContext
)
;
$this
->eventDispatcher->
dispatch
(
$event
)
;
return
$salesChannelContext
;
}
private
function
convertDeliveries
(
OrderDeliveryCollection
$orderDeliveries
, LineItemCollection
$lineItems
)
: DeliveryCollection
{
$cartDeliveries
=
new
DeliveryCollection
(
)
;
foreach
(
$orderDeliveries
as
$orderDelivery
)
{
$deliveryDate
=
new
DeliveryDate
(