Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
DeliveryBuilder example
$salesChannelContext
=
$this
->
createMock
(
SalesChannelContext::
class
)
;
$salesChannelContext
->
expects
(
static
::
any
(
)
)
->
method
(
'getShippingMethod'
)
->
willReturn
(
(
new
ShippingMethodEntity
(
)
)
->
assign
(
[
'id' => 'shipping-method-id',
]
)
)
;
static
::
expectException
(
ShippingException::
class
)
;
static
::
expectExceptionMessage
(
'Shipping method with id "shipping-method-id" not found.'
)
;
(
new
DeliveryBuilder
(
)
)
->
build
(
new
Cart
(
'cart-token'
)
,
new
CartDataCollection
(
[
]
)
,
$salesChannelContext
,
new
CartBehavior
(
)
,
)
;
}
public
function
testBuildDelegatesToBuildByUsingShippingMethod
(
)
: void
{
$shippingMethod
=
(
new
ShippingMethodEntity
(
)
)
->
assign
(
[
'id' => 'shipping-method-id',
]
)
;