Commit Graph

3528 Commits

Author SHA1 Message Date
Rodrigo Primo
a50c20637a Create an empty WC_Emails stub instead of using stdClass in a test
This commit simply improves an integration test that I modified while
working on [MAILPOET-3421] to use an empty WC_Emails stub instead of
using stdClass.
2021-03-01 14:14:19 +01:00
Rodrigo Primo
edbb69a239 Use the woocommerce_email action to customize WC emails
This commit changes the WC action that MailPoet uses to hook into WC and
customize the footer and the header of WC e-mails. Before, MailPoet was
using the woommerce_init action. The problem with using this action to customize
the e-mails is that it runs on every request. Furthermore, since we were calling
WC->mailer() inside the callback, we were instantiating WC_Emails on
every single request (WooCommerce instantiate this class only when
needed).

Replacing woocommerce_init with woocommerce_email means that our code
will run only when needed (right after WooCommerce adds callbacks to the
actions woocommerce_email_header and woocommerce_email_footer) and that
we won't be unnecessarily instantiating WC_Emails ourselves. We get the
singleton instance of this class as a parameter.

[MAILPOET-3421]
2021-03-01 14:14:19 +01:00
Rodrigo Primo
575b34fc97 Fix "Purchased In This Category" email for product variations
The "Purchased In This Category" email was not working for variable
products. This was happening because MailPoet calls
WC_Product::get_category_ids() to get the list of WooCommerce
categories associated with a given product, but this method doesn't work
for product variations (see
https://github.com/woocommerce/woocommerce/issues/12942).

In this commit, I'm implementing a workaround. I changed the code to
check if the product is a product variation and, if so, get the
categories from the parent product instead of the product itself. But I
also plan to raise this issue with the WooCommerce team as, in my opinion,
it is odd that WC_Product::get_category_ids() doesn't work with product
variations and fails silently.

[MAILPOET-3416]
2021-03-01 13:32:52 +01:00
Pavel Dohnal
91386815a2 Use the latest woocommerce for the latest tests
[MAILPOET-3330]
2021-03-01 10:36:00 +01:00
Pavel Dohnal
1312139fb8 Use woocommerce 4.0.1 for the oldest tests
[MAILPOET-3330]
2021-03-01 10:36:00 +01:00
Pavel Dohnal
916aa847ca Use woocommerce 5.0.0 for the acceptance tests
[MAILPOET-3330]
2021-03-01 10:36:00 +01:00
Jan Lysý
c5a11b2bd8 Add acceptance test for the Gutenberg form block
[MAILPOET-3440]
2021-03-01 10:08:08 +01:00
Jan Lysý
76d79397c2 Add methods for name in a form to DataFactory
[MAILPOET-3440]
2021-03-01 10:08:08 +01:00
Rostislav Wolny
438c9a7469 Alter data validation regexp so that is not malformed by wptexturize
[MAILPOET-3440]
2021-03-01 10:08:08 +01:00
Rostislav Wolny
5c38069caa Add scheduled tasks cleanup to tests setup
[MAILPOET-3412]
2021-03-01 08:43:45 +01:00
Rostislav Wolny
ff284cb12f Fix flaky Import test
Comparing timestamps with delta parameter allow values that differs by 1 second.
[MAILPOET-3412]
2021-03-01 08:43:45 +01:00
Jan Lysý
2bf5e93125 Add integration test for ImportExportRepository
[MAILPOET-3378]
2021-02-18 10:13:44 +01:00
Jan Lysý
0347e44893 Use importExportRepository in import
[MAILPOET-3378]
2021-02-18 10:13:44 +01:00
Jan Lysý
d500f872d7 Refactor integration Import test
[MAILPOET-3378]
2021-02-18 10:13:44 +01:00
Jan Lysý
1deaef4321 Use Doctrine in integration test for Import
[MAILPOET-3378]
2021-02-18 10:13:44 +01:00
Jan Lysý
2f1899d810 Add new dependencies to ImportTest
[MAILPOET-3378]
2021-02-18 10:13:44 +01:00
Rostislav Wolny
dc4727117c Fix view in browser link shortcode and extend test
[MAILPOET-3434]
2021-02-17 16:11:59 +01:00
Rostislav Wolny
6bf62ee90a Fix links in form checkbox label
[MAILPOET-3433]
2021-02-17 11:00:15 +01:00
Rostislav Wolny
54cee207ea Remove forgotten test debug code
[MAILPOET-3415]
2021-02-15 13:30:08 +01:00
Rostislav Wolny
6a63ac26c7 Fix naming sanitiser > sanitizer
[MAILPOET-3415]
2021-02-15 13:30:08 +01:00
Rostislav Wolny
c1aef842d2 Fix rendering issues in form blocks
[MAILPOET-3415]
2021-02-15 13:30:08 +01:00
Rostislav Wolny
d00e667b96 Check Custom HTML in form on save
[MAILPOET-3415]
2021-02-15 13:30:08 +01:00
Rostislav Wolny
1fbed46411 Add service for fixing form API data
[MAILPOET-3415]
2021-02-15 13:30:08 +01:00
Rostislav Wolny
e13b2c62a9 Add servise for fixing html in form blocks
[MAILPOET-3415]
2021-02-15 13:30:08 +01:00
Jan Lysý
cd776fe0cf Add tries when CronHelpes ping ends with timeout
[MAILPOET-3413]
2021-02-15 09:34:38 +01:00
Pavel Dohnal
5b5e01465c [MAILPOET-3408] 2021-02-10 14:52:20 +01:00
Veljko
4d6564e757 Fixed flaky scenario of moving a list to trash 2021-02-03 11:02:13 +01:00
Jan Lysý
6337c37e45 Update tests for third party API
[MAILPOET-3307]
2021-02-03 11:01:38 +01:00
Jan Lysý
94ac7f0ef7 Update WP in acceptance test on 5.6
[MAILPOET-3339]
2021-01-28 09:38:10 +01:00
Jan Lysý
f5987359c7 Add integration test on SegmentSaveController
[MAILPOET-3170]
2021-01-26 17:03:48 +01:00
Jan Lysý
180a238b40 Use timestamp for DateTime compare in Segments WPTest
[MAILPOET-3367]
2021-01-25 11:52:25 +01:00
Rostislav Wolny
9868f5cc21 Remove dynamic segments services that are no longer needed
[MAILPOET-3164]
2021-01-25 09:17:17 +01:00
Rostislav Wolny
8456581695 Refactor segment lists fetching methods to separate repository
[MAILPOET-3164]
2021-01-25 09:17:17 +01:00
Rostislav Wolny
cd578e6475 Refactor fetching list of subscribers for export
[MAILPOET-3146]
2021-01-25 09:17:17 +01:00
Pavel Dohnal
4e3dda9872 Fix flakey integration test
[MAILPOET-3336]
2021-01-25 09:04:20 +01:00
Veljko V
72a2dee636 Update test to avoid conflict [MAILPOET-3377]
[MAILPOET-3377]
2021-01-25 09:03:53 +01:00
Veljko
52918cb5f2 Add missing parameter to tests 2021-01-25 09:03:53 +01:00
Veljko
b9c71dafcf Add missing parameter to private functions 2021-01-25 09:03:53 +01:00
Veljko
2208cf5685 Fix flaky test and update test case structure 2021-01-25 09:03:53 +01:00
Veljko
b34b02b0db Fix flaky test for managing lists 2021-01-20 18:03:41 +03:00
Jan Lysý
df794425b7 Remove phpstan-ignores from tests
[MAILPOET-3235]
2021-01-18 14:39:42 +01:00
Jan Lysý
922c52f7df Remove phpstan errors from the rest of the tests
[MAILPOET-3235]
2021-01-18 14:39:42 +01:00
Jan Lysý
cb60c827a2 Remove phpstan errors from integration Newsletter tests
[MAILPOET-3235]
2021-01-18 14:39:42 +01:00
Jan Lysý
d3af5a1621 Remove phpstan errors from integration Models tests
[MAILPOET-3235]
2021-01-18 14:39:42 +01:00
Jan Lysý
8e53e260ef Remove phpstan errors from integration Tasks tests
[MAILPOET-3235]
2021-01-18 14:39:42 +01:00
Jan Lysý
428392ed18 Remove phpstan errors from integration DynamicSegments tests
[MAILPOET-3235]
2021-01-18 14:39:42 +01:00
Jan Lysý
4fd0779dcb Remove phpstan errors from integration Config tests
[MAILPOET-3235]
2021-01-18 14:39:42 +01:00
Jan Lysý
c9004553c3 Remove phpstan errors from integration Cron tests
[MAILPOET-3235]
2021-01-18 14:39:42 +01:00
Jan Lysý
bcb62403a1 Remove phpstan errors from integration API tests
[MAILPOET-3235]
2021-01-18 14:39:42 +01:00
Rostislav Wolny
1d662c5e79 Update form with columns acceptance test
[MAILPOET-3253]
2021-01-18 11:10:30 +01:00