Commit Graph

48 Commits

Author SHA1 Message Date
c4c94c2db0 Change the way getName() is called to get rid of a PHPStan error
[MAILPOET-4695]
2022-10-06 12:16:47 +02:00
ef8bc9250a Change codeception extension to catch skipped tests
This commit changes the Codeception extension CheckSkippedTestsExtension
that we use to generate an error when tests are skipped in the `trunk` and
`release` branches. Now this extension accepts a list of tests that can
be skipped in those two branches. This will be necessary as part of the
project to support WooCommerce Custom Orders Tables as in some scenarios
we want to skip WooCommerce Subscriptions tests and in some we don't.
For now, WooCommerce Subscrptions doesn't support Woo COT, so we want to
run Woo Subscriptions tests when COT is disabled, but we want to skip
then when COT is enabled.

The main change is that now we are using the `TEST_SKIPPED` Codeception event
instead of the `SUITE_AFTER` event. This change was necessary as in the
latter event we don't have any information about the tests that were
skipped.

[MAILPOET-4695]
2022-10-06 12:16:47 +02:00
ff105f8e61 Add helper method to get the name of the WooCommerce orders table
[MAILPOET-4577]
2022-10-05 10:47:06 +02:00
fa4c4d02d6 Update method to enable WooCommerce Custom Orders Tables
The latest version development build of WooCommerce contains a change
that modified the method that should be called to enable Woo Custom
Orders Tables (see this Woo PR for more information:
https://github.com/woocommerce/woocommerce/pull/34727. This commit
update the plugin that we use in the acceptance and integration tests to
reflect this change.

[MAILPOET-4691]
2022-10-04 09:26:11 +02:00
83319949ef Use WooCommerce code instead of direct query to get highest order ID
[MAILPOET-4570]
2022-10-03 09:30:42 +02:00
b6bdce3535 Change insertSubscriberFromOrder() to use WooCommerce methods
This commit changes
\MailPoet\Segments\WooCommerce::insertSubscriberFromOrder() to use
WooCommerce method instead of querying the database directly. This is
needed as WooCommerce is moving away from WP tables and creating its own
tables.

[MAILPOET-4570]
2022-10-03 09:30:42 +02:00
4deb137063 Rename method in repository
[MAILPOET-4685]
2022-09-29 15:19:09 -03:00
b371c631c4 Add helper mu-plugin for adding COT in tests
When plugin is active COT is enabled. The plugin also adds WP CLI command
for creating custom order tables so that we don't have to do it via admin UI.
[MAILPOET-4572]
2022-09-19 11:38:03 -03:00
f2e355f7d5 Refactor building newsletters lists
Because some customers have a memory issue when we load all newsletters.
I used partial loading newsletters to prevent this error that was caused by json in the newsletter body.
[MAILPOET-4646]
2022-09-19 14:32:55 +02:00
5c57dd2006 Add saving tags for imported subscribers
[MAILPOET-4558]
2022-09-15 11:26:10 +02:00
43ece08227 Remove errors to be ignored by PHPStan that don't exist anymore
Fixing the logic to load the PHPStan baseline in the previous commit,
uncovered some ignored errors in phpstan-8.1-baseline.neon that don't
exist anymore.

[MAILPOET-4626]
2022-09-12 10:28:59 +01:00
76501d89d2 Fix logic to decide which PHPStan baseline file to use
There was a bug in the code that is used to decide which version of
the PHPStan baseline file should be loaded depending on the PHP
version that is being used.

The if condition for PHP 8.1 was `$phpVersion == 80100` which means
that it matched only PHP 8.1.0 and not any of the 8.1 patch
versions (like 8.1.1 and 8.1.2).

This commit fixes this problem and it also changes the order of the
checks so that they follow the version numbers in ascending order.
Before the checks where unordered.

[MAILPOET-4626]
2022-09-12 10:28:59 +01:00
842f81d40b Add method to detected if WooCommerce Custom Order Tables is enabled
[MAILPOET-4567]
2022-09-09 10:43:11 +02:00
0b54ae6506 Refactor updating create and modified dates in WooCommerce order factory
[MAILPOET-4566]
2022-09-08 13:02:52 +02:00
dde3b159ea Add status parameter to getWorkflows method
[MAILPOET-4417]
2022-08-24 14:02:08 +02:00
ed56df2398 Add WorkflowTemplate GET endpoint
[MAILPOET-4538]
2022-08-23 14:03:24 +02:00
baa4d369af Introduce template storage and rebuild create form template endpoint
[MAILPOET-4538]
2022-08-23 14:03:24 +02:00
d874375c25 Remove MP2 migration main class and its test class
This commit removes the main MP2 migration class and its test class. It
also removes two SQL files that were used in the test class. One of
those files executed the following query:

`SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"`

Removing this query made the tests inside SubscriberSegmentTest fail
when running the whole integration test suite. To work around this, I
added the above mentioned query to SubscriberSegmentTest. I'm not sure
why this test class fails without this query when running all the tests
but it doesn't when it is executed alone. Probably there is another test
class changing the SQL_MODE. Since SubscriberSegmentTest is a test class
for a Paris model that we will eventually remove, I decided it was not
necessary to investigate this further.

[MAILPOET-4376]
2022-08-15 12:46:22 +02:00
7e9149f2aa Query workflow by version in StepRunner
[MAILPOET-4430]
2022-08-10 16:57:25 +02:00
571a91b809 Fix setting segment type
[MAILPOET-4292]
2022-07-14 11:29:09 +02:00
670e6e4cba Replace Swift Mailer for PHPMailer
[MAILPOET-4142]
2022-05-23 11:38:32 +02:00
1dd2c82634 Load PHPMailer
We don't support old loading for WordPress 5.5 and lower
[MAILPOET-4142]
2022-05-23 11:38:32 +02:00
47c5111996 Add method to fetch list of workflows to workflow storage
[MAILPOET-4287]
2022-05-19 10:09:05 +02:00
cf2a0eb5cc Get the list of tables to truncate when running tests dynamically
While removing some deprecated models in the commit
a525b96f16, I noticed that we maintain a
list of tables that needs to be truncated before running the integration
tests. To make it easier when removing future models and to make sure
the list of tables is always updated, in this commit, I'm removing the
manual list and changing the code to dynamically get the tables and
truncate them.

The code that I removed from _bootstrap.php, meant that PHPStan error
was not present anymore, so it was possible to update its baseline files
to remove the ignores for that error.

[MAILPOET-4325]
2022-05-16 11:33:00 +02:00
780dd7f609 Use data factory for test newsletter
MAILPOET-4236
2022-05-16 11:17:29 +02:00
6e0b639fd3 Use intval instead of (int) to remove PHPStan errors
[MAILPOET-4281]
2022-05-09 13:05:21 +02:00
bb3d1c2a7c Fix type error in meta in SubscribersEmailCount task
[MAILPOET-4281]
2022-05-09 13:05:21 +02:00
abd4c7b52d Switch WooProductBlock hooks and extender class by version
[MAILPOET-4276]
2022-05-09 10:41:12 +02:00
c08bde077b Update symfony/dependency-injection package to v5
[MAILPOET-4227]
2022-04-27 08:57:54 +02:00
Sam
c32dc0a372 Revert "Revert "Define BlockPostQuery for nicer args processing for quering""
This reverts commit 62e393a76d.
2022-04-18 11:43:47 +02:00
62e393a76d Revert "Define BlockPostQuery for nicer args processing for quering"
This reverts commit 5b40a585e7.
2022-04-11 16:30:59 -03:00
5b40a585e7 Define BlockPostQuery for nicer args processing for quering
[MAILPOET-4082]
2022-04-11 14:54:56 -03:00
36baf4c4e3 Simplify the query to calculate lifetime emails
Get max and count of subscribers in the query.

[MAILPOET-4177]
2022-04-07 10:17:38 +02:00
8b7b234446 Create controller to count emails per subscriber
This controller is built to be called by a cron SimpleWorker.

[MAILPOET-4177]
2022-04-07 10:17:38 +02:00
cb55cae1b2 Escape SQL queries following wp org sniffs
[MAILPOET-4129]
2022-04-04 17:12:33 +02:00
a8d88beec9 Escape output according to WP sniffs
[MAILPOET-4129]
2022-04-04 17:12:33 +02:00
2e374d1a3b Remove unused property from Pages
[MAILPOET-4020]
2022-04-04 16:24:21 +02:00
11d4ae47a8 Remove Listing Handler unused methods
[MAILPOET-4006]
2022-04-04 15:33:52 +02:00
095f85c897 Update PHPStan and fix new issues
[MAILPOET-4175]
2022-03-28 13:49:41 +02:00
93acb2b39c Remove outdated ignore error statements
[MAILPOET-3535]
2022-03-24 16:00:56 +01:00
ac52f2af99 Introduce phpstan-type for MailerLog data
[MAILPOET-4122]
2022-03-21 10:17:37 +01:00
1bc004adce Update PHPStan
[MAILPOET-4055]
2022-03-09 14:11:03 +01:00
bb962a5af6 Upgrade PHPStan and update baselines
[MAILPOET-4131]
2022-03-07 16:07:16 +01:00
da951e77af Enforce type hints in automation directory
[MAILPOET-4135]
2022-02-21 09:56:26 +01:00
75ab2338d6 Remove backward compatibility code for email action filters
This commit cleans up code that is no longer needed after email actions filter data migration.
[MAILPOET-3951]
2022-01-19 16:18:08 +01:00
efa7a55486 Fix cannot access offset PHP stan errors in EmailActionsTest
[MAILPOET-3951]
2022-01-19 16:18:08 +01:00
391e19f692 Improve compatibility BatchIterator with PHP 8.1
[MAILPOET-4053]
2022-01-19 13:14:42 +01:00
9f790efbf0 Move plugin files to a subfolder
[MAILPOET-3988]
2022-01-18 15:30:22 +01:00