Skip to content

Commit

Permalink
Add createdVia to unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
scottyzen committed May 22, 2023
1 parent c3235c0 commit c981aec
Show file tree
Hide file tree
Showing 2 changed files with 173 additions and 175 deletions.
347 changes: 172 additions & 175 deletions tests/wpunit/CheckoutMutationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,181 +85,178 @@ function() {
);
}

private function getCheckoutMutation() {
return '
mutation checkout( $input: CheckoutInput! ) {
checkout( input: $input ) {
clientMutationId
order {
id
databaseId
currency
orderVersion
date
modified
status
discountTotal
discountTax
shippingTotal
shippingTax
cartTax
total
totalTax
subtotal
orderNumber
orderKey
createdVia
pricesIncludeTax
parent {
id
}
customer {
id
}
customerIpAddress
customerUserAgent
customerNote
billing {
firstName
lastName
company
address1
address2
city
state
postcode
country
email
phone
}
shipping {
firstName
lastName
company
address1
address2
city
state
postcode
country
}
paymentMethod
paymentMethodTitle
transactionId
dateCompleted
datePaid
cartHash
shippingAddressMapUrl
hasBillingAddress
hasShippingAddress
isDownloadPermitted
needsShippingAddress
hasDownloadableItem
downloadableItems {
nodes {
url
accessExpires
downloadId
downloadsRemaining
name
product {
databaseId
}
download {
downloadId
}
}
}
needsPayment
needsProcessing
metaData {
key
value
}
couponLines {
nodes {
databaseId
orderId
code
discount
discountTax
coupon {
id
}
}
}
feeLines {
nodes {
databaseId
orderId
amount
name
taxStatus
total
totalTax
taxClass
}
}
shippingLines {
nodes {
databaseId
orderId
methodTitle
total
totalTax
taxClass
}
}
taxLines {
nodes {
rateCode
label
taxTotal
shippingTaxTotal
isCompound
taxRate {
databaseId
}
}
}
lineItems {
nodes {
productId
variationId
quantity
taxClass
subtotal
subtotalTax
total
totalTax
taxStatus
product {
node {
... on SimpleProduct {
id
}
... on VariableProduct {
id
}
}
}
variation {
node {
id
}
}
}
}
}
customer {
id
}
result
redirect
}
}
';
}
private function checkout( $input, $mutation = null ) {
if ( ! $mutation ) {
$mutation = '
mutation checkout( $input: CheckoutInput! ) {
checkout( input: $input ) {
clientMutationId
order {
id
databaseId
currency
orderVersion
date
modified
status
discountTotal
discountTax
shippingTotal
shippingTax
cartTax
total
totalTax
subtotal
orderNumber
orderKey
createdVia
pricesIncludeTax
parent {
id
}
customer {
id
}
customerIpAddress
customerUserAgent
customerNote
billing {
firstName
lastName
company
address1
address2
city
state
postcode
country
email
phone
}
shipping {
firstName
lastName
company
address1
address2
city
state
postcode
country
}
paymentMethod
paymentMethodTitle
transactionId
dateCompleted
datePaid
cartHash
shippingAddressMapUrl
hasBillingAddress
hasShippingAddress
isDownloadPermitted
needsShippingAddress
hasDownloadableItem
downloadableItems {
nodes {
url
accessExpires
downloadId
downloadsRemaining
name
product {
databaseId
}
download {
downloadId
}
}
}
needsPayment
needsProcessing
metaData {
key
value
}
couponLines {
nodes {
databaseId
orderId
code
discount
discountTax
coupon {
id
}
}
}
feeLines {
nodes {
databaseId
orderId
amount
name
taxStatus
total
totalTax
taxClass
}
}
shippingLines {
nodes {
databaseId
orderId
methodTitle
total
totalTax
taxClass
}
}
taxLines {
nodes {
rateCode
label
taxTotal
shippingTaxTotal
isCompound
taxRate {
databaseId
}
}
}
lineItems {
nodes {
productId
variationId
quantity
taxClass
subtotal
subtotalTax
total
totalTax
taxStatus
product {
... on SimpleProduct {
id
}
... on VariableProduct {
id
}
}
variation {
id
}
}
}
}
customer {
id
}
result
redirect
}
}
';
}

private function getCartQuery() {
return '
Expand Down
1 change: 1 addition & 0 deletions tests/wpunit/OrderMutationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ private function orderMutation( $input, $operation_name = 'createOrder', $input_
transactionId
dateCompleted
datePaid
createdVia
cartHash
shippingAddressMapUrl
hasBillingAddress
Expand Down

0 comments on commit c981aec

Please sign in to comment.