Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
createLineItems example
yield
'with order empty line items' =>
[
'entity' => self::
createOrderEntity
(
[
'lineItems' =>
new
OrderLineItemCollection
(
)
,
]
)
,
'expected' => self::
getExpected
(
)
,
]
;
yield
'with order line items' =>
[
'entity' => self::
createOrderEntity
(
[
'lineItems' => self::
createLineItems
(
)
,
]
)
,
'expected' => self::
getExpected
(
[
'lineItems' => '3x |2x ',
]
)
,
]
;
yield
'with order empty deliveries' =>
[
'entity' => self::
createOrderEntity
(
[
'deliveries' =>
[
]
,
]
)
,
'expected' => self::
getExpected
(
[
return
$this
->builder->
build
(
$cart
,
$data
,
$this
->context,
$cartBehaviour
)
;
}
private
function
createCart
(
bool
$withoutLineItems
= false
)
: Cart
{
$cart
=
new
Cart
(
'test'
)
;
if
(
$withoutLineItems
)
{
return
$cart
;
}
$lineItems
=
$this
->
createLineItems
(
)
;
$cart
->
addLineItems
(
$lineItems
)
;
return
$cart
;
}
private
function
createLineItems
(
)
: LineItemCollection
{
$lineItems
=
new
LineItemCollection
(
)
;
$lineItem
=
$this
->
createLineItem
(
)
;
$lineItems
->
add
(
$lineItem
)
;