Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setOrderCustomer example
$order
->
setId
(
Uuid::
randomHex
(
)
)
;
$order
->
setBillingAddressId
(
'order-address-id'
)
;
$order
->
setCurrencyId
(
'order-currency-id'
)
;
$order
->
setLanguageId
(
'order-language-id'
)
;
$order
->
setSalesChannelId
(
TestDefaults::SALES_CHANNEL
)
;
$order
->
setTotalRounding
(
$this
->cashRoundingConfig
)
;
$order
->
setItemRounding
(
$this
->cashRoundingConfig
)
;
$order
->
setRuleIds
(
[
'order-rule-id-1', 'order-rule-id-2'
]
)
;
$order
->
setTaxStatus
(
CartPrice::TAX_STATE_FREE
)
;
if
(
$toManipulate
!== 'order-no-order-customer'
)
{
$order
->
setOrderCustomer
(
$this
->
getOrderCustomer
(
)
)
;
}
if
(
$toManipulate
!== 'order-no-transactions'
)
{
$order
->
setTransactions
(
$orderTransactionCollection
)
;
}
if
(
$toManipulate
!== 'order-no-line-items'
)
{
$order
->
setLineItems
(
$orderLineItemCollection
)
;
}
if
(
$toManipulate
!== 'order-no-deliveries'
)
{
$order
->
setDeliveries
(
$orderDeliveryCollection
)
;
}
if
(
$toManipulate
!== 'order-no-order-number'
)
{
public
function
testRestoreHasDataOrder
(
)
: void
{
$flow
=
new
StorableFlow
(
'test', Context::
createDefaultContext
(
)
,
[
OrderAware::ORDER_ID => Uuid::
randomHex
(
)
]
)
;
$customer
=
new
OrderCustomerEntity
(
)
;
$customer
->
setId
(
Uuid::
randomHex
(
)
)
;
$customer
->
setFirstName
(
'bar'
)
;
$customer
->
setLastName
(
'foo'
)
;
$customer
->
setEmail
(
'foo@bar.com'
)
;
$order
=
new
OrderEntity
(
)
;
$order
->
setOrderCustomer
(
$customer
)
;
$order
->
setSalesChannelId
(
TestDefaults::SALES_CHANNEL
)
;
$flow
->
setData
(
OrderAware::ORDER,
$order
)
;
$this
->storer->
restore
(
$flow
)
;
static
::
assertTrue
(
$flow
->
hasData
(
MailAware::MAIL_STRUCT
)
)
;
static
::
assertInstanceOf
(
MailRecipientStruct::
class
,
$flow
->
getData
(
MailAware::MAIL_STRUCT
)
)
;
static
::
assertEquals
(
'barfoo',
$flow
->
getData
(
MailAware::MAIL_STRUCT
)
->
getRecipients
(
)
[
'foo@bar.com'
]
)
;
static
::
assertNull
(
$flow
->
getData
(
MailAware::MAIL_STRUCT
)
->
getBcc
(
)
)
;
static
::
assertNull
(
$flow
->
getData
(
MailAware::MAIL_STRUCT
)
->
getCc
(
)
)
;
}