@@ -50,89 +50,8 @@ protected function setUp():void
50
50
*/
51
51
public function testGetCustomerOrdersSimpleProductQuery ()
52
52
{
53
- $ query =
54
- <<<QUERY
55
- {
56
- customer
57
- {
58
- orders(filter:{number:{eq:"100000002"}}){
59
- total_count
60
- items
61
- {
62
- id
63
- number
64
- status
65
- order_date
66
- payment_methods
67
- {
68
- name
69
- type
70
- additional_data
71
- {
72
- name
73
- value
74
- }
75
- }
76
- shipping_address {
77
- ... address
78
- }
79
- billing_address {
80
- ... address
81
- }
82
- items{
83
- quantity_ordered
84
- product_sku
85
- product_name
86
- product_sale_price{currency value}
87
- }
88
- total {
89
- base_grand_total {
90
- value
91
- currency
92
- }
93
- grand_total {
94
- value
95
- currency
96
- }
97
- subtotal {
98
- value
99
- currency
100
- }
101
-
102
- }
103
- }
104
- }
105
- }
106
- }
107
-
108
- fragment address on OrderAddress {
109
- firstname
110
- lastname
111
- city
112
- company
113
- country_code
114
- fax
115
- middlename
116
- postcode
117
- prefix
118
- street
119
- region
120
- region_id
121
- suffix
122
- telephone
123
- vat_id
124
- }
125
- QUERY ;
126
-
127
- $ currentEmail = 'customer@example.com ' ;
128
- $ currentPassword = 'password ' ;
129
- $ response = $ this ->graphQlQuery (
130
- $ query ,
131
- [],
132
- '' ,
133
- $ this ->customerAuthenticationHeader ->execute ($ currentEmail , $ currentPassword )
134
- );
135
-
53
+ $ orderNumber = '100000002 ' ;
54
+ $ response = $ this ->getCustomerOrderQueryOnSimpleProducts ($ orderNumber );
136
55
$ this ->assertArrayHasKey ('orders ' , $ response ['customer ' ]);
137
56
$ this ->assertArrayHasKey ('items ' , $ response ['customer ' ]['orders ' ]);
138
57
$ this ->assertNotEmpty ($ response ['customer ' ]['orders ' ]['items ' ]);
@@ -198,14 +117,12 @@ public function testCustomerOrdersSimpleProductWithTaxesAndDiscounts()
198
117
'company ' => 'Test company ' ,
199
118
'country_code ' => 'US ' ,
200
119
'postcode ' => '78717 ' ,
201
- 'prefix ' => 'John ' ,
202
120
'region ' => 'Texas ' ,
203
121
'region_id ' => '57 ' ,
204
122
'street ' => [
205
123
0 => 'test street 1 ' ,
206
124
1 => 'test street 2 ' ,
207
125
],
208
- 'suffix ' => 'John ' ,
209
126
'telephone ' => '5123456677 '
210
127
];
211
128
$ this ->assertResponseFields ($ customerOrderResponse [0 ]["billing_address " ], $ billingAssertionMap );
@@ -216,14 +133,12 @@ public function testCustomerOrdersSimpleProductWithTaxesAndDiscounts()
216
133
'company ' => 'test company ' ,
217
134
'country_code ' => 'US ' ,
218
135
'postcode ' => '36013 ' ,
219
- 'prefix ' => 'test shipFirst ' ,
220
136
'street ' => [
221
137
0 => 'test street 1 ' ,
222
138
1 => 'test street 2 ' ,
223
139
],
224
140
'region_id ' => '1 ' ,
225
141
'region ' => 'Alabama ' ,
226
- 'suffix ' => 'test shipFirst ' ,
227
142
'telephone ' => '3347665522 '
228
143
];
229
144
$ this ->assertResponseFields ($ customerOrderResponse [0 ]["shipping_address " ], $ shippingAssertionMap );
@@ -1348,11 +1263,9 @@ private function getCustomerOrderQuery($orderNumber): array
1348
1263
fax
1349
1264
middlename
1350
1265
postcode
1351
- prefix
1352
1266
street
1353
1267
region
1354
1268
region_id
1355
- suffix
1356
1269
telephone
1357
1270
vat_id
1358
1271
}
@@ -1371,6 +1284,98 @@ private function getCustomerOrderQuery($orderNumber): array
1371
1284
return $ response ['customer ' ]['orders ' ]['items ' ];
1372
1285
}
1373
1286
1287
+ /**
1288
+ * Get customer order query
1289
+ *
1290
+ * @param string $orderNumber
1291
+ * @return array
1292
+ */
1293
+ private function getCustomerOrderQueryOnSimpleProducts ($ orderNumber ): array
1294
+ {
1295
+ $ query =
1296
+ <<<QUERY
1297
+ {
1298
+ customer
1299
+ {
1300
+ orders(filter:{number:{eq:" {$ orderNumber }"}}) {
1301
+ total_count
1302
+ items
1303
+ {
1304
+ id
1305
+ number
1306
+ status
1307
+ order_date
1308
+ payment_methods
1309
+ {
1310
+ name
1311
+ type
1312
+ additional_data
1313
+ {
1314
+ name
1315
+ value
1316
+ }
1317
+ }
1318
+ shipping_address {
1319
+ ... address
1320
+ }
1321
+ billing_address {
1322
+ ... address
1323
+ }
1324
+ items{
1325
+ quantity_ordered
1326
+ product_sku
1327
+ product_name
1328
+ product_sale_price{currency value}
1329
+ }
1330
+ total {
1331
+ base_grand_total {
1332
+ value
1333
+ currency
1334
+ }
1335
+ grand_total {
1336
+ value
1337
+ currency
1338
+ }
1339
+ subtotal {
1340
+ value
1341
+ currency
1342
+ }
1343
+ }
1344
+ }
1345
+ }
1346
+ }
1347
+ }
1348
+
1349
+ fragment address on OrderAddress {
1350
+ firstname
1351
+ lastname
1352
+ city
1353
+ company
1354
+ country_code
1355
+ fax
1356
+ middlename
1357
+ postcode
1358
+ street
1359
+ region
1360
+ region_id
1361
+ telephone
1362
+ vat_id
1363
+ }
1364
+ QUERY ;
1365
+ $ currentEmail = 'customer@example.com ' ;
1366
+ $ currentPassword = 'password ' ;
1367
+ $ response = $ this ->graphQlQuery (
1368
+ $ query ,
1369
+ [],
1370
+ '' ,
1371
+ $ this ->customerAuthenticationHeader ->execute ($ currentEmail , $ currentPassword )
1372
+ );
1373
+
1374
+ $ this ->assertArrayHasKey ('orders ' , $ response ['customer ' ]);
1375
+ $ this ->assertArrayHasKey ('items ' , $ response ['customer ' ]['orders ' ]);
1376
+ return $ response ;
1377
+ }
1378
+
1374
1379
/**
1375
1380
* Clean up orders
1376
1381
*
0 commit comments