Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getOrderDateTime example
static
::
assertSame
(
$serialized
[
'deliveries'
]
[
'shippingOrderAddress'
]
[
'department'
]
,
$shippingAddress
->
getDepartment
(
)
)
;
static
::
assertSame
(
$serialized
[
'deliveries'
]
[
'shippingOrderAddress'
]
[
'countryId'
]
,
$shippingAddress
->
getCountryId
(
)
)
;
static
::
assertSame
(
$serialized
[
'deliveries'
]
[
'shippingOrderAddress'
]
[
'countryStateId'
]
,
$shippingAddress
->
getCountryStateId
(
)
)
;
static
::
assertNotNull
(
$lineItems
=
$order
->
getLineItems
(
)
)
;
static
::
assertNotNull
(
$lineItem
=
$lineItems
->
first
(
)
)
;
static
::
assertSame
(
$serialized
[
'lineItems'
]
, '1x ' .
$lineItem
->
getProductId
(
)
)
;
static
::
assertSame
(
$serialized
[
'amountTotal'
]
,
$order
->
getAmountTotal
(
)
)
;
static
::
assertSame
(
$serialized
[
'stateId'
]
,
$order
->
getStateId
(
)
)
;
static
::
assertSame
(
$serialized
[
'orderDateTime'
]
,
$order
->
getOrderDateTime
(
)
->
format
(
'Y-m-d\Th:i:s.vP'
)
)
;
}
private
function
createOrder
(
)
: OrderEntity
{
// create product
$productId
= Uuid::
randomHex
(
)
;
$product
=
$this
->
getProductData
(
$productId
)
;
/** @var EntityRepository $productRepository */
$productRepository
=
$this
->
getContainer
(
)
->
get
(
'product.repository'
)
;
$productRepository
->
create
(
[
$product
]
, Context::
createDefaultContext
(
)
)
;
$product
=
$lineItem
;
}
}
static
::
assertNotNull
(
$product
)
;
static
::
assertNotNull
(
$product
->
getPrice
(
)
)
;
$productPriceInclTax
= 10 +
(
$productPrice
*
$productTaxRate
/ 100
)
;
static
::
assertSame
(
$product
->
getPrice
(
)
->
getUnitPrice
(
)
,
$productPriceInclTax
)
;
/** @var TaxRule $taxRule */
$taxRule
=
$product
->
getPrice
(
)
->
getTaxRules
(
)
->
first
(
)
;
static
::
assertSame
(
$taxRule
->
getTaxRate
(
)
,
$productTaxRate
)
;
static
::
assertNotNull
(
$order
->
getOrderDateTime
(
)
)
;
static
::
assertEquals
(
$order
->
getOrderDateTime
(
)
,
$orderDateTime
)
;
}
public
function
testChangeShippingCosts
(
)
: void
{
// create order
$cart
=
$this
->
generateDemoCart
(
)
;
$orderId
=
$this
->
persistCart
(
$cart
)
[
'orderId'
]
;
// create version of order
$versionId
=
$this
->
createVersionedOrder
(
$orderId
)
;