Commit Graph

15684 Commits

Author SHA1 Message Date
46ebe847be Revert "Replace all Paris models with Doctrine code in SchedulerTest"
This reverts commit 54e2d173c1.
2022-05-17 12:27:46 +02:00
a2053158a4 Revert "Add new data factory to create NewsletterOption entities in the tests"
This reverts commit caab02cd88.
2022-05-17 12:27:46 +02:00
08d025eea5 Revert "Add method to the Newsletter datafactory to set the type to automatic"
This reverts commit 0ebc92d7da.
2022-05-17 12:27:46 +02:00
69c2df9e49 Revert "Use Doctrine entities and truncate only what is used in SubscriberTest"
This reverts commit bcd33de9ed.
2022-05-17 12:27:46 +02:00
2a5a68a110 Remove integration tests for deprecated models
This commit removes the integration tests for the models
NewsletterOptionField and NewsletterOption as they have been deprecated.

[MAILPOET-4150]
2022-05-16 13:18:21 +02:00
725b7b0bf5 Deprecate models NewsletterOption and NewsletterOptionField
Those models are being deprecated as they are not used anymore in our
codebase.

[MAILPOET-4150]
2022-05-16 13:18:21 +02:00
73aa081876 Deprecate some unused Models\Newsletter methods
This commit deprecates the following Models\Newsletter methods:

- \MailPoet\Models\Newsletter::filterType()
- \MailPoet\Models\Newsletter::getWelcomeNotificationsForSegments()
- \MailPoet\Models\Newsletter::duplicate()

I'm doing this as part of a ticket to replace the models
NewsletterOption and NewsletterOptionField with Doctrine code. The
methods deprecated here use those models. But since they are not used
anymore in our codebase, I figured it would be easier to deprecate them
instead of replacing the models.

[MAILPOET-4150]
2022-05-16 13:18:21 +02:00
d89067854c Replace NewsletterOption and NewsletterOptionField models
This commit repleaces the old NewsletterOption and NewsletterOptionField
models with Doctrine code in several test classes.

[MAILPOET-4150]
2022-05-16 13:18:21 +02:00
f48bb5758c Replace all Paris models with Doctrine code in SchedulerTest
[MAILPOET-4150]
2022-05-16 13:18:21 +02:00
9b525a14b4 Add new data factory to create NewsletterOption entities in the tests
[MAILPOET-4150]
2022-05-16 13:18:21 +02:00
5ccd43e336 Add method to the Newsletter datafactory to set the type to automatic
[MAILPOET-4150]
2022-05-16 13:18:21 +02:00
dc65d0f70c Use Doctrine entities and truncate only what is used in SubscriberTest
This commit replaces old Paris code with Doctrine entities in
SubscriberTest::_after() and it also truncate only the entities that are
actually used inside the test class. Before this change, the class was
unnecessarily truncating entities that were not used. I'm doing this
commit as part of task to remove all usages of the old NewsletterOption
model and that is why I'm not touching the remaining models in other
methods of this class.

[MAILPOET-4150]
2022-05-16 13:18:21 +02:00
ba99d331f1 Remove duplicated code
[MAILPOET-4209]
2022-05-16 13:15:59 +02:00
81bfbd5bf4 Add autocomplete attribute for text inputs in forms
[MAILPOET-4284]
2022-05-16 13:15:59 +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
01f0585400 Remove three Paris models that have been deprecated over six months ago
This commit removes the models Form, NewsletterLink and
StatisticsUnsubscribes as they were deprecated over six months ago and
are not used anymore in our codebase.

[MAILPOET-4325]
2022-05-16 11:33:00 +02:00
8c7097df85 Add / when generating the Iframe URL
[MAILPOET-4337]
2022-05-16 11:31:39 +02:00
780dd7f609 Use data factory for test newsletter
MAILPOET-4236
2022-05-16 11:17:29 +02:00
0159418251 Remove unnecessarily specific test
This case is handled in the newsletter validator's integration tests

MAILPOET-4236
2022-05-16 11:17:29 +02:00
115fe9c511 Make test more generic
We already have a specific test for the newsletter validator to check
for the missing unsubscribe link case. All we really care about for the
sending queue is that it rejects newsletters that are considered invalid
 for any reason.

MAILPOET-4236
2022-05-16 11:17:29 +02:00
702d00c6e4 Refactor to use service override helper
MAILPOET-4236
2022-05-16 11:17:29 +02:00
c98f3bba29 Refactor mock service creation to use new helper
MAILPOET-4236
2022-05-16 11:17:29 +02:00
ab609c8867 Remove subscriber check from newsletter validator
Checking the subscriber limit has nothing to do with the newsletter
itself, so it makes more sense to continue to perform that check as
needed elsewhere in the codebase.

MAILPOET-4236
2022-05-16 11:17:29 +02:00
73c023449b Use simpler method for overriding DI properties
MAILPOET-4236
2022-05-16 11:17:29 +02:00
42b95d5b72 Ensure strings will still be picked up for translation
MAILPOET-4236
2022-05-16 11:17:29 +02:00
8983d5e3f7 Move subscriber limit check into validator
[MAILPOET-4236]
2022-05-16 11:17:29 +02:00
9bfe2b2ca1 Newsletter validation updates
- Rename validator to newsletterValidator for clarity
- Add validation for ALC content
- Refactor tests to use data factory for consistency and to avoid
validation issues
- Add separate tests for NewsletterValidator service
- Add test helper for retrieving service with private properties
overridden by name

[MAILPOET-4236]
2022-05-16 11:17:29 +02:00
a5103f9596 Move reengagement validations into validator
[MAILPOET-4236]
2022-05-16 11:17:29 +02:00
27a86d2ca6 Check validity on activating newsletters
This prevents users from activating automatic emails from listing pages
that are not valid.

This also adds more checks for the content of a newsletter, requiring
that a newsletter have at least one content block in order to be valid.
This change makes the server side validation check match what we're
checking in the editor in mailpoet/assets/js/src/newsletter_editor
/components/save.js and mailpoet/assets/js/src/newsletters/send.jsx

[MAILPOET-4236]
2022-05-16 11:17:29 +02:00
fdaf22d46b Extract newsletter validation to a service
[MAILPOET-4236]
2022-05-16 11:17:29 +02:00
f547eea48b Small refactor to move duplicated code to a private method in AutomatedEmailsTest
[MAILPOET-4150]
2022-05-13 08:45:28 +02:00
611cf5abb7 Deprecate StatisticsWooCommercePurchases model as it is not used anymore
We can remove this model after six months.

[MAILPOET-4150]
2022-05-13 08:45:28 +02:00
1c9a5afc2b Deprecate the old model StatisticsOpens
This model is not used anymore in our codebase and can be removed after
a six months grace period.

[MAILPOET-4150]
2022-05-13 08:45:28 +02:00
0f5700bf2b Replace old model StatisticsOpens with Doctrine code in StatisticsNewsletters
The test class \MailPoet\Subscribers\ImportExport\PersonalDataExporters\NewslettersExporterTest
calls the modified
\MailPoet\Models\StatisticsNewsletters::getAllForSubscriber() method
several times so it can be used to confirm that the changes made in this
commit work as expected.

[MAILPOET-4150]
2022-05-13 08:45:28 +02:00
e6dd8fedbf Replace old model StatisticsOpens in OpensTest and NewslettersExporterTest
[MAILPOET-4150]
2022-05-13 08:45:28 +02:00
d010cb1a69 Deprecate the model StatisticsClicks
This model is not used anymore in our codebase and can be removed after
a six months grace period.

[MAILPOET-4150]
2022-05-13 08:45:28 +02:00
98fee5778f Replace StatisticsClicks and StatisticsOpens models in WooCommercePastRevenues
Replace old Paris code with Doctrine code

I was not able to test that the command `./do gen:data past_revenues` is
still working after the changes here as it is failing on master due to
an unrelated error. I will start a discussion about this problema and
potentially create a Jira ticket.

[MAILPOET-4150]
2022-05-13 08:45:28 +02:00
ae65f06471 Small refactor to get an instance of EntityManager only once
[MAILPOET-4150]
2022-05-13 08:45:28 +02:00
394353781d Replace Paris models with Doctrine code in WorkerTest.php
This commit replaces the models StatisticsClicks and StatisticsOpens

[MAILPOET-4150]
2022-05-13 08:45:28 +02:00
8e8460e0fd Replace Paris models with Doctrine code in ClicksTest
This commit replaces the models StatisticsClicks and StatisticsOpens

[MAILPOET-4150]
2022-05-13 08:45:28 +02:00
2df41bdf63 Replace remaining Paris code from AutomatedEmailsTest with Doctrine code
[MAILPOET-4150]
2022-05-13 08:45:28 +02:00
bddf8a7e4c Replace old Newsletter model with Doctrine entity in AutomatedEmailsTest
I'm doing as part of the ticket to replace other models as it will make
replacing MailPoet\Models\StatisticsClicks and
MailPoet\Models\StatisticsOpens in AutomatedEmailsTest easier.

[MAILPOET-4150]
2022-05-13 08:45:28 +02:00
6c98e5adcf Deprecate DynamicSegmentFilter model as it is not used anymore
We can remove this model after six months.

[MAILPOET-4150]
2022-05-13 08:45:28 +02:00
f5543b1990 Overwrite add_role method when creating test users
[MAILPOET-2834]
2022-05-12 11:41:57 +02:00
7b33a94d37 Add set_user_role hook
[MAILPOET-2834]
2022-05-12 11:41:57 +02:00
7e43385040 Switch newRole and oldRole in array_diff to get correct difference
[MAILPOET-2834]
2022-05-12 11:41:57 +02:00
9bd6f29870 Add add_user_role hook to synchronizeUser
[MAILPOET-2834]
2022-05-12 11:41:57 +02:00
f15a7634e5 Update circleci/mysql:5.5 to cimg/mysql:5.7
Circle ci does not offer cimg/mysql:5.5, so we have to update to cimg/mysql:5.7

MAILPOET-4103
2022-05-12 09:02:44 +02:00
aa0ce4a092 Update circleci/mysql 5.7.27 and 8.0 to cimg/mysql
MAILPOET-4103
2022-05-12 09:02:44 +02:00
ed3b46390c Reuse types instead of redefining them
[MAILPOET-4323]
2022-05-11 14:26:58 +02:00