Commit Graph

84 Commits

Author SHA1 Message Date
Jan Jakes
0bf7e5e77f Add a fix for PHPStan issue causing polyfills not being loaded
We can remove this fix when the issue is resolved:
https://github.com/phpstan/phpstan/issues/7732

[MAILPOET-4946]
2023-04-20 16:32:32 +02:00
Rodrigo Primo
769a11048e Remove PHPStan ignored error as it is not happening anymore
[MAILPOET-5232]
2023-04-17 14:33:51 -03:00
John Oleksowicz
d505bffcfd Refactor to use shared date functionality
MAILPOET-4986
2023-04-03 10:20:02 +02:00
David Remer
fcf6e738c7 Interrupt automation run creation if a run already exists and only_once setting is set
[MAILPOET-4966]
2023-03-01 16:14:38 +01:00
David Remer
c4faa53386 Store run subjects in extra table
[MAILPOET-4966]
2023-03-01 16:14:38 +01:00
Rodrigo Primo
26bdf7e20c Fix PHPStan errors in the data factories classes
[MAILPOET-4037]
2023-02-23 14:13:17 +01:00
Rodrigo Primo
a9a3c53245 Fix PHPStan errors in the acceptance tests
[MAILPOET-4037]
2023-02-23 14:13:17 +01:00
Rodrigo Primo
678911a8bc Fix PHPStan baseline errors in a few integration test files
[MAILPOET-4037]
2023-02-23 14:13:17 +01:00
Rodrigo Primo
2bcd1ace70 Fix PHPStan errors in tests/integration/Segments/DynamicSegments/
[MAILPOET-4037]
2023-02-23 14:13:17 +01:00
Rodrigo Primo
6374ce9ad3 Remove unused parameter from getSubscribersCount() to fix a PHPStan error
[MAILPOET-4037]
2023-02-23 14:13:17 +01:00
Rodrigo Primo
775ab32037 Fix PHPStan baseline errors in a few test files
[MAILPOET-4037]
2023-02-23 14:13:17 +01:00
Rostislav Wolny
04307ca2a6 Compute change of global subscribed subscribers
[MAILPOET-4828]
2023-02-22 13:54:31 +01:00
Rodrigo Primo
f324abd1d0 Update woocommerce-stubs to version 7.3.0
[MAILPOET-4313]
2023-02-01 08:57:47 +02:00
Rodrigo Primo
1161e6f3f6 Add MailPoet task to WooCommerce homepage
[MAILPOET-4814]
2023-01-30 15:01:42 +01:00
Rostislav Wolny
03d7306611 Add check from automation flows with welcome emails
This commit improves the check that a user has set a welcome email campaign (a task in product discovery task list)
by checking also for automation flows that are triggered by new subscriber or user and contain
send email action.
[MAILPOET-4827]
2023-01-23 16:48:52 +01:00
Brezo Cordero
49b2f5528f Remove Migration class
Remove from container, test factory and PHPStan baselines.

[MAILPOET-4478]
2023-01-23 15:35:50 +01:00
Pavel Dohnal
e3ba525195 Unify inheritance with other processors
[MAILPOET-4735]
2022-12-21 10:07:35 +01:00
Jan Jakes
926620e8f8 Ignore strict types rule in all existing files that don't have it
[MAILPOET-2688]
2022-11-29 15:04:09 +01:00
Jan Jakes
c67c58709b Unify spacing of declare statements
[MAILPOET-2688]
2022-11-29 15:04:09 +01:00
David Remer
6ddfe2c605 Remove ignores no longer needed
[MAILPOET-4258]
2022-11-25 14:32:34 +01:00
David Remer
4832771185 Refactor the captcha system
The current Captcha class has a lot of responsibilities. It renders the captcha
image, can check if a certain captcha type is a Google captcha, if a captcha is
required for a certain email. The SubscriberSubscribeController is not only in
charge of "controlling" the subscription process but also validates, whether a
captcha is correct or not. This architecture made it difficult to extend the
functionality and introduce the audio captcha feature.

Therefore this commit refactors the captcha architecture and tries to seperate
the different concerns into several classes and objects. Validation is now done
by validators.

The CaptchaPhrase now is in charge of keeping the captcha phrase consistent
between the image and the new audio, so that you can renew the captcha and both
captchas are in sync.

[MAILPOET-4514]
2022-11-24 09:20:39 +01:00
Jan Jakes
9d55d3f134 Use "automation" instead of "workflow"
[MAILPOET-4793]
2022-11-14 12:14:35 +02:00
Jan Jakes
c6d3573652 Save next step ID to workflow runs
[MAILPOET-4787]
2022-11-08 22:55:57 +02:00
Jan Jakes
467f354eb1 Do not skip workflow trigger queries when trigger keys are empty
[MAILPOET-4778]
2022-11-08 16:17:34 +02:00
Jan Jakes
679f74e498 Unify query error checking
[MAILPOET-4778]
2022-11-08 16:17:34 +02:00
Jan Jakes
cc5959805b Use "workflow_triggers" table instead of an inline JSON
[MAILPOET-4778]
2022-11-08 16:17:34 +02:00
Jan Jakes
9730fb9272 Move the old dbDelta-based migrator to a migration
This will ensure it runs once and from there, it will continue using the new migrations.

[MAILPOET-4466]
2022-11-07 10:05:42 +01:00
Jan Jakes
dd10389c55 Implement WP CLI command to show migrations info
[MAILPOET-4466]
2022-11-07 10:05:42 +01:00
Rodrigo Primo
ea16472ab1 Use Codeception\TestInterface::getName() instead of Codeception\TestInterface::getMetadata()
This commit changes the code to use $event->getTest()->getName() instead
of $event->getTest()->getMetadata()->getName() to get the name of the
current test. This was necessary because the latter was returning null
for integration tests while the former works both for acceptance and
integration tests. I did not investigate why Codeception behaves this
way due to lack of time, there is a chance that this is a bug in
Codeception.

Since $event->getTest() returns an instance of TestInterface and this
class does not define getName() (but the call works probably due to some
magic method), it was necessary to edit phpstan.neon to skip a PHPStan
error.

[MAILPOET-4765]
2022-11-04 12:43:48 +01:00
Rostislav Wolny
a6431678ed Remove backward compatibility for Woo Blocks ExtendRestApi
The new ExtendSchema was introduced in WCBlocks 7.2 which are way older
then we currently want to support.
[MAILPOET-4774]
2022-11-03 15:16:43 +01:00
Rostislav Wolny
cdcdfb135c Update php-stubs/woocommerce-stubs to the latest version
[MAILPOET-4774]
2022-11-03 15:16:43 +01:00
David Remer
9773408c8b Add getCountForWorkflow method to return how many runs exist for specific status
[MAILPOET-4731]
2022-10-25 12:46:07 +02:00
David Remer
57548b579f Add method to fetch all runs of a workflow
[MAILPOET-4731]
2022-10-25 12:46:07 +02:00
Rodrigo Primo
dd1fcd5100 Add helper method to get the name of the WooCommerce order addresses table
[MAILPOET-4711]
2022-10-19 11:32:41 +02:00
Rostislav Wolny
a03f8f1c30 Use action scheduler's unique single action for daemon run
With the new unique parameter added in the action scheduler 3.5.0 the
as_schedule_single_action that schedules an immediate action
seems to be more convenient for the action scheduler.
We get better control over the scheduling of subsequent runs.
Note: We don't want to use the async action that is also executed immediately,
but it has the highest priority and we don't want to block actions scheduled by other plugins.
[MAILPOET-4684]
2022-10-13 14:21:43 +02:00
Rostislav Wolny
1711d60871 Schedule recurring actions as unique to prevent duplicate actions
We had some cases of multiple triggers created most probably because of a race conditions.
The unique action functionality added in the action scheduled 3.5.0 should prevent it.
[MAILPOET-4684]
2022-10-13 14:21:43 +02:00
Rodrigo Primo
c4c94c2db0 Change the way getName() is called to get rid of a PHPStan error
[MAILPOET-4695]
2022-10-06 12:16:47 +02:00
Rodrigo Primo
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
Rodrigo Primo
ff105f8e61 Add helper method to get the name of the WooCommerce orders table
[MAILPOET-4577]
2022-10-05 10:47:06 +02:00
Rodrigo Primo
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
Rodrigo Primo
83319949ef Use WooCommerce code instead of direct query to get highest order ID
[MAILPOET-4570]
2022-10-03 09:30:42 +02:00
Rodrigo Primo
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
Jan Lysý
4deb137063 Rename method in repository
[MAILPOET-4685]
2022-09-29 15:19:09 -03:00
Rostislav Wolny
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
Jan Lysý
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
Jan Lysý
5c57dd2006 Add saving tags for imported subscribers
[MAILPOET-4558]
2022-09-15 11:26:10 +02:00
Rodrigo Primo
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
Rodrigo Primo
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
Rodrigo Primo
842f81d40b Add method to detected if WooCommerce Custom Order Tables is enabled
[MAILPOET-4567]
2022-09-09 10:43:11 +02:00
Rostislav Wolny
0b54ae6506 Refactor updating create and modified dates in WooCommerce order factory
[MAILPOET-4566]
2022-09-08 13:02:52 +02:00