Commit Graph

118 Commits

Author SHA1 Message Date
John Oleksowicz
61bb3a65d7 Add backend logic for customer text field filters
MAILPOET-4990
2023-06-28 15:14:03 +02:00
Rodrigo Primo
de3d3a5fe2 Fix: subscriber segmentation can now target contacts who did not open any emails
There was a bug in the query that is used to get the subscribers that
opened emails that was preventing it from working when trying to get
subscribers that opened zero emails.

The problem was that we were adding the user_agent_type	as a condition
on the WHERE part of the clause. Meaning that it was being used to
filter the overall results and thus excluding all subscribers that had
no entries in the wp_mailpoet_statistics_opens table. By moving this
condition to the ON clause in the LEFT JOIN, we use the user_agent_type
field to match rows between tables. The value of this field will still
be taken into consideration when counting the number of opens as we are
counting the number of entries in the wp_mailpoet_statistics_opens
table.

[MAILPOET-5347]
2023-06-05 13:46:43 +02:00
Rodrigo Primo
43ee076562 Change the behavior of the country segment
This commit changes the behavior of the country segment to include
subscribers that never placed an order (or placed orders that failed or
were canceled) as long as they have a country set in the WooCommerce
customer lookup table.

[MAILPOET-4188]
2023-06-05 12:26:03 +02:00
John Oleksowicz
ec68818c1a Add filter for used payment method
MAILPOET-4993
2023-05-19 11:57:13 +02:00
John Oleksowicz
e636537580 Add ability to duplicate dynamic segments
MAILPOET-4635
2023-05-15 13:48:41 +02:00
John Oleksowicz
974cd32950 Dynamic segment filter for first/last name and email
MAILPOET-4997
2023-05-12 13:59:12 +02:00
John Oleksowicz
9c6f957154 Move more functionality to test helper to create orders
MAILPOET-4987
2023-05-11 11:47:01 +02:00
John Oleksowicz
d8e29e9edb Prefix average spent fields
MAILPOET-4987
2023-05-11 11:47:01 +02:00
John Oleksowicz
ca2a6ceac8 Add missing options and fix order of options
MAILPOET-4987
2023-05-11 11:47:01 +02:00
John Oleksowicz
a2853236fc Add average order value filter
MAILPOET-4987
2023-05-11 11:47:01 +02:00
John Oleksowicz
f75173dcd5 Add "subscribed via form" dynamic filter
MAILPOET-5005
2023-05-09 13:10:08 +02:00
John Oleksowicz
8a66c83257 Add "was sent email" filter
MAILPOET-5004
2023-05-01 11:28:25 +02:00
John Oleksowicz
5e9b83bf2d Add required cleanup
MAILPOET-5083
2023-04-13 17:56:13 +02:00
John Oleksowicz
aaa08d5ab6 Add missing group
MAILPOET-5083
2023-04-13 17:56:13 +02:00
John Oleksowicz
cf7cfe40f8 Remove unused imports
MAILPOET-5083
2023-04-13 17:56:13 +02:00
John Oleksowicz
6b2faeeecb Remove unnecessary cleanup
MAILPOET-5083
2023-04-13 17:56:13 +02:00
John Oleksowicz
f3f7d4dc61 Remove redundant tests
MAILPOET-5083
2023-04-13 17:56:13 +02:00
John Oleksowicz
4576dd289f Add woo filter helper tests for order status
MAILPOET-5083
2023-04-13 17:56:13 +02:00
John Oleksowicz
096ab74ee3 Use helper for creating customers
MAILPOET-5145
2023-04-13 17:56:13 +02:00
John Oleksowicz
40fc3882f3 Use correct statuses for category filter
MAILPOET-5083
2023-04-13 17:56:13 +02:00
John Oleksowicz
2caa535098 Use correct statuses for product filter
MAILPOET-5083
2023-04-13 17:56:13 +02:00
John Oleksowicz
aa7bd6eb67 Use correct statuses for number of orders filter
MAILPOET-5083
2023-04-13 17:56:13 +02:00
John Oleksowicz
192bdce421 Refactor tests to use helper
MAILPOET-5083
2023-04-13 17:56:13 +02:00
Rodrigo Primo
5d1ae1f9d0 Force sync with customers lookup table after a change in Woo core
A unintentional side-effect in Woo core < 7.6 synched the customer
lookup table immediately after the creation of an order. This
unintentional behavior was removed in Woo 7.6 and now we need to call
\Automattic\WooCommerce\Admin\API\Reports\Customers\DataStore::sync_order_customer()
explicitly for Woo to add to the customer lookup table.

Without this change, a few tests in WooCommerceCountryTest were failing
when running with Woo 7.6. As far as I could check this change does not
affect anything else in MP other than the tests.

[MAILPOET-5148]
2023-04-11 11:30:09 -05:00
John Oleksowicz
428f52fdb6 Update tests not included in original PR
MAILPOET-5145
2023-04-07 20:17:05 -05:00
John Oleksowicz
cf67ad2a83 Add missing parent::_after calls
MAILPOET-5145
2023-04-07 12:11:12 -05:00
John Oleksowicz
c848c62ee9 Remove unnecessary cleanup code
MAILPOET-5145
2023-04-07 12:11:12 -05:00
John Oleksowicz
cd0b795ac8 Extract customer creation/cleanup
This also ensures that cleanup always runs after all integration tests

MAILPOET-5145
2023-04-07 12:11:12 -05:00
John Oleksowicz
c75bc388c9 Remove unnecessary cleanup code
MAILPOET-5145
2023-04-07 12:11:12 -05:00
John Oleksowicz
57eb438eb8 Don't assume auto increment of 1
MAILPOET-5145
2023-04-07 12:11:12 -05:00
John Oleksowicz
03da98e5df Avoid simple text replacements in SQL if possible
MAILPOET-4986
2023-04-03 10:20:02 +02:00
John Oleksowicz
caba21b8af Fix relative date calculation
MAILPOET-4986
2023-04-03 10:20:02 +02:00
John Oleksowicz
d52113d104 Extract shared date filter functionality
MAILPOET-4986
2023-04-03 10:20:02 +02:00
John Oleksowicz
37226202bc Implement purchase date dynamic filter
MAILPOET-4986
2023-04-03 10:20:02 +02:00
Rodrigo Primo
8e0211913a Add basic integration test for the new single order value WC segment
[MAILPOET-4988]
2023-03-28 15:51:01 +02:00
Rostislav Wolny
e1be576525 Fix coding style issue in Woo Subscriptions filter test
[MAILPOET-4568]
2023-03-27 12:26:35 +02:00
Rostislav Wolny
4200781a56 Remove temporary action for disabling Woo compatibility check in test
WooSubscriptions declared compatibility with HPOS in version 4.9.0
[MAILPOET-4568]
2023-03-27 12:26:35 +02:00
Rostislav Wolny
78feddd30a Enable WooSubscriptions test when HPOS is active
We need to temporarily turn off plugin compatibility check in Woo
because current Woo Subscriptions are still officially not marked as
HPOS compatible.
[MAILPOET-4568]
2023-03-27 12:26:35 +02:00
Rostislav Wolny
14515c4140 Refactor WooSubscriptions integration test to use factory instead post
The factory uses wcs_create_subscription and creates the subscription order
in proper table according to HPOS setting.
[MAILPOET-4568]
2023-03-27 12:26:35 +02:00
Rodrigo Primo
2bcd1ace70 Fix PHPStan errors in tests/integration/Segments/DynamicSegments/
[MAILPOET-4037]
2023-02-23 14:13:17 +01:00
Rostislav Wolny
78446d174a Fix quotes in a queries processed by $wpdb
These queries failed when ANSI_QUOTES mode is enabled
[MAILPOET-4887]
2022-12-12 13:59:09 +01:00
Jan Jakes
82aeb89854 Use strict types in tests
[MAILPOET-2688]
2022-11-29 15:04:09 +01:00
David Remer
7db40b27b5 Fix errors automatically with phpcbf
[MAILPOET-4850]
2022-11-28 22:54:13 +03:00
David Remer
d2ec7bba42 Replace instance_of asserts in integration tests
[MAILPOET-4258]
2022-11-25 14:32:34 +01:00
Rodrigo Primo
f2ab875bd9 Skip WooCommerce Subscriptions integration tests when Woo COT is enabled
WooCommerce Subscriptions doesn't support WooCommerce Custom Orders
Tables, so we should skip the WooCommerce Subscriptions related tests
when Woo COT is enabled.

[MAILPOET-4695]
2022-10-07 18:31:10 +02:00
Rostislav Wolny
960bac746e Refactor WooCommerceCountryTest to use Woo code for creating test data
[MAILPOET-4566]
2022-09-08 13:02:52 +02:00
Rostislav Wolny
3f186ea655 Fix inserting values into order lookup table
This fixes error on CI: Invalid datetime format: 1292 Incorrect datetime value: '0000-00-00 00:00:00' for column 'date_created' at row 1
Locally this error wasn't present but we use a different DB because of ARM architecture.
Also previously we created the lookup table using a custom SQL but now they are created by WooCommerce plugin itself.
[MAILPOET-4566]
2022-09-08 13:02:52 +02:00
Rostislav Wolny
0d594c2bb3 Remove usages of Database helper for creating WooCommerce tables in tests
This is no longer needed since the tables are created when we activate the plugin.
[MAILPOET-4566]
2022-09-08 13:02:52 +02:00
Rostislav Wolny
ed5bd8de61 Add Woo dependent tests to woo group
Mark all integration tests that are related to WooCommerce with group "woo".
[MAILPOET-4566]
2022-09-08 13:02:52 +02:00
John Oleksowicz
8665750767 Use new helpers for creating orders
MAILPOET-4566
2022-09-08 13:02:52 +02:00