Skip to content

Commit c981aec

Browse files
committed
Add createdVia to unit tests
1 parent c3235c0 commit c981aec

File tree

2 files changed

+173
-175
lines changed

2 files changed

+173
-175
lines changed

tests/wpunit/CheckoutMutationTest.php

Lines changed: 172 additions & 175 deletions
Original file line numberDiff line numberDiff line change
@@ -85,181 +85,178 @@ function() {
8585
);
8686
}
8787

88-
private function getCheckoutMutation() {
89-
return '
90-
mutation checkout( $input: CheckoutInput! ) {
91-
checkout( input: $input ) {
92-
clientMutationId
93-
order {
94-
id
95-
databaseId
96-
currency
97-
orderVersion
98-
date
99-
modified
100-
status
101-
discountTotal
102-
discountTax
103-
shippingTotal
104-
shippingTax
105-
cartTax
106-
total
107-
totalTax
108-
subtotal
109-
orderNumber
110-
orderKey
111-
createdVia
112-
pricesIncludeTax
113-
parent {
114-
id
115-
}
116-
customer {
117-
id
118-
}
119-
customerIpAddress
120-
customerUserAgent
121-
customerNote
122-
billing {
123-
firstName
124-
lastName
125-
company
126-
address1
127-
address2
128-
city
129-
state
130-
postcode
131-
country
132-
email
133-
phone
134-
}
135-
shipping {
136-
firstName
137-
lastName
138-
company
139-
address1
140-
address2
141-
city
142-
state
143-
postcode
144-
country
145-
}
146-
paymentMethod
147-
paymentMethodTitle
148-
transactionId
149-
dateCompleted
150-
datePaid
151-
cartHash
152-
shippingAddressMapUrl
153-
hasBillingAddress
154-
hasShippingAddress
155-
isDownloadPermitted
156-
needsShippingAddress
157-
hasDownloadableItem
158-
downloadableItems {
159-
nodes {
160-
url
161-
accessExpires
162-
downloadId
163-
downloadsRemaining
164-
name
165-
product {
166-
databaseId
167-
}
168-
download {
169-
downloadId
170-
}
171-
}
172-
}
173-
needsPayment
174-
needsProcessing
175-
metaData {
176-
key
177-
value
178-
}
179-
couponLines {
180-
nodes {
181-
databaseId
182-
orderId
183-
code
184-
discount
185-
discountTax
186-
coupon {
187-
id
188-
}
189-
}
190-
}
191-
feeLines {
192-
nodes {
193-
databaseId
194-
orderId
195-
amount
196-
name
197-
taxStatus
198-
total
199-
totalTax
200-
taxClass
201-
}
202-
}
203-
shippingLines {
204-
nodes {
205-
databaseId
206-
orderId
207-
methodTitle
208-
total
209-
totalTax
210-
taxClass
211-
}
212-
}
213-
taxLines {
214-
nodes {
215-
rateCode
216-
label
217-
taxTotal
218-
shippingTaxTotal
219-
isCompound
220-
taxRate {
221-
databaseId
222-
}
223-
}
224-
}
225-
lineItems {
226-
nodes {
227-
productId
228-
variationId
229-
quantity
230-
taxClass
231-
subtotal
232-
subtotalTax
233-
total
234-
totalTax
235-
taxStatus
236-
product {
237-
node {
238-
... on SimpleProduct {
239-
id
240-
}
241-
... on VariableProduct {
242-
id
243-
}
244-
}
245-
}
246-
variation {
247-
node {
248-
id
249-
}
250-
}
251-
}
252-
}
253-
}
254-
customer {
255-
id
256-
}
257-
result
258-
redirect
259-
}
260-
}
261-
';
262-
}
88+
private function checkout( $input, $mutation = null ) {
89+
if ( ! $mutation ) {
90+
$mutation = '
91+
mutation checkout( $input: CheckoutInput! ) {
92+
checkout( input: $input ) {
93+
clientMutationId
94+
order {
95+
id
96+
databaseId
97+
currency
98+
orderVersion
99+
date
100+
modified
101+
status
102+
discountTotal
103+
discountTax
104+
shippingTotal
105+
shippingTax
106+
cartTax
107+
total
108+
totalTax
109+
subtotal
110+
orderNumber
111+
orderKey
112+
createdVia
113+
pricesIncludeTax
114+
parent {
115+
id
116+
}
117+
customer {
118+
id
119+
}
120+
customerIpAddress
121+
customerUserAgent
122+
customerNote
123+
billing {
124+
firstName
125+
lastName
126+
company
127+
address1
128+
address2
129+
city
130+
state
131+
postcode
132+
country
133+
email
134+
phone
135+
}
136+
shipping {
137+
firstName
138+
lastName
139+
company
140+
address1
141+
address2
142+
city
143+
state
144+
postcode
145+
country
146+
}
147+
paymentMethod
148+
paymentMethodTitle
149+
transactionId
150+
dateCompleted
151+
datePaid
152+
cartHash
153+
shippingAddressMapUrl
154+
hasBillingAddress
155+
hasShippingAddress
156+
isDownloadPermitted
157+
needsShippingAddress
158+
hasDownloadableItem
159+
downloadableItems {
160+
nodes {
161+
url
162+
accessExpires
163+
downloadId
164+
downloadsRemaining
165+
name
166+
product {
167+
databaseId
168+
}
169+
download {
170+
downloadId
171+
}
172+
}
173+
}
174+
needsPayment
175+
needsProcessing
176+
metaData {
177+
key
178+
value
179+
}
180+
couponLines {
181+
nodes {
182+
databaseId
183+
orderId
184+
code
185+
discount
186+
discountTax
187+
coupon {
188+
id
189+
}
190+
}
191+
}
192+
feeLines {
193+
nodes {
194+
databaseId
195+
orderId
196+
amount
197+
name
198+
taxStatus
199+
total
200+
totalTax
201+
taxClass
202+
}
203+
}
204+
shippingLines {
205+
nodes {
206+
databaseId
207+
orderId
208+
methodTitle
209+
total
210+
totalTax
211+
taxClass
212+
}
213+
}
214+
taxLines {
215+
nodes {
216+
rateCode
217+
label
218+
taxTotal
219+
shippingTaxTotal
220+
isCompound
221+
taxRate {
222+
databaseId
223+
}
224+
}
225+
}
226+
lineItems {
227+
nodes {
228+
productId
229+
variationId
230+
quantity
231+
taxClass
232+
subtotal
233+
subtotalTax
234+
total
235+
totalTax
236+
taxStatus
237+
product {
238+
... on SimpleProduct {
239+
id
240+
}
241+
... on VariableProduct {
242+
id
243+
}
244+
}
245+
variation {
246+
id
247+
}
248+
}
249+
}
250+
}
251+
customer {
252+
id
253+
}
254+
result
255+
redirect
256+
}
257+
}
258+
';
259+
}
263260

264261
private function getCartQuery() {
265262
return '

tests/wpunit/OrderMutationsTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ private function orderMutation( $input, $operation_name = 'createOrder', $input_
105105
transactionId
106106
dateCompleted
107107
datePaid
108+
createdVia
108109
cartHash
109110
shippingAddressMapUrl
110111
hasBillingAddress

0 commit comments

Comments
 (0)