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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]