@@ -18,6 +18,9 @@ public function _before(AcceptanceTester $I)
18
18
// Activate Plugin.
19
19
$ I ->activateWooCommerceAndConvertKitPlugins ($ I );
20
20
21
+ // Disable HPOS.
22
+ $ I ->disableWooCommerceHPOS ($ I );
23
+
21
24
// Setup WooCommerce Plugin.
22
25
$ I ->setupWooCommercePlugin ($ I );
23
26
@@ -166,6 +169,50 @@ public function testSyncPastOrderExcludesRefunds(AcceptanceTester $I)
166
169
$ I ->dontSeeElementInDOM ('a#ckwc_sync_past_orders ' );
167
170
}
168
171
172
+ /**
173
+ * Test that no button is displayed on the Integration Settings screen
174
+ * when:
175
+ * - the Integration is enabled,
176
+ * - valid API credentials are specified,
177
+ * - a WooCommerce Order exists, that has no email address.
178
+ *
179
+ * @since 1.9.3
180
+ *
181
+ * @param AcceptanceTester $I Tester.
182
+ */
183
+ public function testSyncPastOrderExcludesOrdersWithNoEmailAddress (AcceptanceTester $ I )
184
+ {
185
+ // Delete all existing WooCommerce Orders from the database.
186
+ $ I ->wooCommerceDeleteAllOrders ($ I );
187
+
188
+ // Create Product and Checkout for this test, not sending the Order
189
+ // to ConvertKit.
190
+ $ result = $ I ->wooCommerceCreateProductAndCheckoutWithConfig (
191
+ $ I ,
192
+ [
193
+ 'send_purchase_data ' => false ,
194
+ ]
195
+ );
196
+
197
+ // Login as the Administrator.
198
+ $ I ->loginAsAdmin ();
199
+
200
+ // Load Settings screen.
201
+ $ I ->loadConvertKitSettingsScreen ($ I );
202
+
203
+ // Confirm that the Sync Past Order button is displayed.
204
+ $ I ->seeElementInDOM ('a#ckwc_sync_past_orders ' );
205
+
206
+ // Remove the email address from the Order.
207
+ $ I ->wooCommerceChangeOrderEmailAddress ($ I , $ result ['order_id ' ], '' );
208
+
209
+ // Load Settings screen.
210
+ $ I ->loadConvertKitSettingsScreen ($ I );
211
+
212
+ // Confirm that no Sync Past Order button is displayed.
213
+ $ I ->dontSeeElementInDOM ('a#ckwc_sync_past_orders ' );
214
+ }
215
+
169
216
/**
170
217
* Test that a button is displayed on the Integration Settings screen
171
218
* when:
@@ -232,8 +279,8 @@ public function testSyncPastOrder(AcceptanceTester $I)
232
279
$ I ->seeInSource ('Enable Kit integration ' );
233
280
234
281
// Confirm that the Transaction ID is stored in the Order's metadata.
235
- $ I ->wooCommerceOrderMetaKeyAndValueExist ($ I , $ postID , 'ckwc_purchase_data_sent ' , 'yes ' , true );
236
- $ I ->wooCommerceOrderMetaKeyAndValueExist ($ I , $ postID , 'ckwc_purchase_data_id ' , $ purchaseDataID, true );
282
+ $ I ->wooCommerceOrderMetaKeyAndValueExist ($ I , $ postID , 'ckwc_purchase_data_sent ' , 'yes ' );
283
+ $ I ->wooCommerceOrderMetaKeyAndValueExist ($ I , $ postID , 'ckwc_purchase_data_id ' , $ purchaseDataID );
237
284
}
238
285
239
286
/**
@@ -276,7 +323,7 @@ public function testSyncPastOrderCreatedInPreviousPluginVersion(AcceptanceTester
276
323
277
324
// Remove the Transaction ID metadata in the Order, as if it were sent
278
325
// by 1.4.2 or older.
279
- $ I ->wooCommerceOrderDeleteMeta ($ I , $ postID , 'ckwc_purchase_data_id ' , true );
326
+ $ I ->wooCommerceOrderDeleteMeta ($ I , $ postID , 'ckwc_purchase_data_id ' );
280
327
281
328
// Login as the Administrator.
282
329
$ I ->loginAsAdmin ();
@@ -306,8 +353,8 @@ public function testSyncPastOrderCreatedInPreviousPluginVersion(AcceptanceTester
306
353
$ I ->seeElementInDOM ('a.cancel[disabled] ' );
307
354
308
355
// Confirm that the Transaction ID is stored in the Order's metadata.
309
- $ I ->wooCommerceOrderMetaKeyAndValueExist ($ I , $ postID , 'ckwc_purchase_data_sent ' , 'yes ' , true );
310
- $ I ->wooCommerceOrderMetaKeyAndValueExist ($ I , $ postID , 'ckwc_purchase_data_id ' , $ purchaseDataID, true );
356
+ $ I ->wooCommerceOrderMetaKeyAndValueExist ($ I , $ postID , 'ckwc_purchase_data_sent ' , 'yes ' );
357
+ $ I ->wooCommerceOrderMetaKeyAndValueExist ($ I , $ postID , 'ckwc_purchase_data_id ' , $ purchaseDataID );
311
358
}
312
359
313
360
/**
0 commit comments