Jan Jakes
0872edba99
Fix multisite tests failing on trunk
...
The fix for single-site was done in 895c2ad3e1
,
this commit adds a fix for multisite.
[MAILPOET-5835]
2024-01-17 13:02:48 -06:00
Rodrigo Primo
895c2ad3e1
Make sure WP user is deleted after each test
...
Doing this to avoid causing problems in other tests from other classes.
Without removing the WP user here we were getting the following failure
in CircleCI:
```
1) MailerTest: It can prepare subscriber for sending
Test tests/integration/Cron/Workers/SendingQueue/Tasks/MailerTest.php:testItCanPrepareSubscriberForSending
[MailPoetVendor\Doctrine\DBAL\Exception\UniqueConstraintViolationException] An exception occurred while executing 'INSERT INTO mp_mailpoet_subscribers (wp_user_id, is_woocommerce_user, first_name, last_name, email, status, subscribed_ip, confirmed_ip, confirmed_at, last_subscribed_at, unconfirmed_data, source, count_confirmations, unsubscribe_token, link_token, engagement_score, engagement_score_updated_at, last_engagement_at, last_sending_at, last_open_at, last_click_at, last_purchase_at, last_page_view_at, woocommerce_synced_at, email_count, created_at, updated_at, deleted_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params [null, 0, "John", "Doe", "test@example.com ", "subscribed", null, null, null, "2023-11-23 19:31:34", null, "unknown", 0, null, null, null, null, null, null, null, null, null, null, null, 0, "2023-11-23 19:31:34", "2023-11-23 19:31:34", null]:
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'test@example.com ' for key 'email'
```
https://app.circleci.com/pipelines/github/mailpoet/mailpoet/16312/workflows/c241bba8-27b9-411e-aa60-ab51af4efc58/jobs/276761?invite=true#step-105-405846_52
[MAILPOET-5737]
2024-01-17 22:32:37 +05:00
Jan Jakes
2a1245bd8a
Remove SendingQueueEntity::$subscribers
...
This doesn't seem to be used anywhere. For scheduled task subscribers, we have
ScheduledTaskEntity::$subscribers collection.
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
Jan Jakes
8cbccf5b7b
Remove unnecessary code from SchedulerTest
...
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
Jan Jakes
434b76e4f4
Extract creating scheduler mock to a method
...
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
Jan Jakes
258e92e804
Simplify SchedulerTest::testItDeletesQueueDuringProcessingWhenNewsletterIsSoftDeleted()
...
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
Jan Jakes
90f1b6ccae
Simplify SchedulerTest::testItFailsToProcessPostNotificationNewsletterWhenSubscribersNotInSegment()
...
There is no need to mock "deleteQueueOrUpdateNextRunDate" to make the subscriber-segment check work.
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
Jan Jakes
5ddbca3eb3
Improve SchedulerTest::testItProcessesScheduledStandardNewsletter()
...
Added NewsletterEntity::TYPE_STANDARD to make it correspond better to the fucntion name.
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
Jan Jakes
2d5a9cf965
Improve SchedulerTest::testItFailsMailpoetSubscriberVerificationWhenSubscriberIsNotInSegment()
...
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
Jan Jakes
dfd9871263
Improve SchedulerTest::testItFailsMailpoetSubscriberVerificationWhenSubscriberDoesNotExist()
...
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
Jan Jakes
96da9b3b9c
Improve SchedulerTest::testItProcessesWelcomeNewsletterWhenWPUserIsVerified()
...
Added NewsletterEntity::TYPE_WELCOME to make it correspond better to the fucntion name,
plus fixed a comment.
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
Jan Jakes
a9db6ce12e
Improve SchedulerTest::testItProcessesWelcomeNewsletterWhenSubscriberIsVerified()
...
Added NewsletterEntity::TYPE_WELCOME to make it correspond better to the fucntion name,
plus fixed a comment.
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
Jan Jakes
54b3e627e1
Improve SchedulerTest::testItDoesNotProcessWelcomeNewsletterWhenThereAreNoSubscribersToProcess()
...
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
Jan Jakes
d614b52d57
Fix and improve SchedulerTest::testItFailsWPSubscriberVerificationWhenSubscriberIsNotAWPUser()
...
This test would pass even with correct WP user ID, as there was a role mismatch ("author" vs. "editor").
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
Jan Jakes
2bd79a0068
Simplify and improve SchedulerTest::testItCanRescheduleQueueDeliveryTime()
...
The entity fetching for Doctrine is no longer needed, added more checks.
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
Jan Jakes
5daef869d6
Simplify and improve SchedulerTest::testItCanDeleteQueueWhenDeliveryIsSetToImmediately()
...
The entity fetching for Doctrine is no longer needed, added more checks.
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
Jan Jakes
d7cb84d20f
Fix and improve SchedulerTest::testItDeletesScheduledAutomationEmailWhenUserDoesNotExist()
...
Having no segment and no task subscriber caused the test pass even without removing the subscriber.
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
Jan Jakes
dd5a11a34f
Fix and improve SchedulerTest::testItDeletesScheduledAutomaticEmailWhenUserDoesNotExist()
...
Having no segment and no task subscriber caused the test pass even without removing the subscriber.
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
Jan Jakes
2de356bcbb
Fix and improve SchedulerTest::testItDeletesQueueDuringProcessingWhenNewsletterNotFound()
...
Having no segment and no task subscriber caused the test pass even without removing the newsletter.
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
Jan Jakes
d1530ca3e0
Rewrite ShedulerTest using Doctrine
...
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
Rodrigo Primo
2ced2b4afa
Replace expect()->lessThan() with verify()->lessThan()
...
codeception/verify 2.1 removed support for expect()->lessThan() so we need
to replace it with verify()->lessThan().
[MAILPOET-5664]
2023-10-24 08:58:22 +03:00
Rodrigo Primo
a54e1f3c01
Replace expect()->greaterOrEquals() with verify()->greaterThanOrEqual()
...
codeception/verify 2.1 removed support for expect()->greaterOrEquals() so we need
to replace it with verify()->greaterThanOrEqual().
[MAILPOET-5664]
2023-10-24 08:58:22 +03:00
Rodrigo Primo
4bc4e9b254
Replace expect()->startsWith() with verify()->stringStartsWith()
...
codeception/verify 2.1 removed support for expect()->startsWith() so we need
to replace it with verify()->stringStartsWith().
[MAILPOET-5664]
2023-10-24 08:58:22 +03:00
Rodrigo Primo
525495409c
Replace expect()->notNull() with verify()->notNull()
...
codeception/verify 2.1 removed support for expect()->notNull() so we need
to replace it with verify()->notNull().
[MAILPOET-5664]
2023-10-24 08:58:22 +03:00
Rodrigo Primo
9b56fdc688
Replace expect()->count() with verify()->arrayCount()
...
codeception/verify 2.1 removed support for expect()->count() so we need
to replace it with verify()->arrayCount().
[MAILPOET-5664]
2023-10-24 08:58:22 +03:00
Rodrigo Primo
e4136fee8c
Replace expect()->isEmpty() with verify()->empty()
...
codeception/verify 2.1 removed support for expect()->isEmpty() so we need
to replace it with verify()->empty().
[MAILPOET-5664]
2023-10-24 08:58:22 +03:00
Rodrigo Primo
5bc5b5ebd2
Replace expect()->notEmpty() with verify()->notEmpty()
...
codeception/verify 2.1 removed support for expect()->notEmpty() so we need
to replace it with verify()->notEmpty().
[MAILPOET-5664]
2023-10-24 08:58:22 +03:00
Rodrigo Primo
00c5250cff
Replace expect()->notEquals() with verify()->notEquals()
...
codeception/verify 2.1 removed support for expect()->notEquals() so we need
to replace it with verify()->notEquals().
[MAILPOET-5664]
2023-10-24 08:58:22 +03:00
Rodrigo Primo
709be1d541
Replace expect()->null() with verify()->null()
...
codeception/verify 2.1 removed support for expect()->null() so we need
to replace it with verify()->null().
[MAILPOET-5664]
2023-10-24 08:58:22 +03:00
Rodrigo Primo
997f635d4a
Replace expect()->false() with verify()->false()
...
codeception/verify 2.1 removed support for expect()->false() so we need
to replace it with verify()->false().
[MAILPOET-5664]
2023-10-24 08:58:22 +03:00
Rodrigo Primo
9adbf81a78
Replace expect()->true() with verify()->true()
...
codeception/verify 2.1 removed support for expect()->true() so we need
to replace it with verify()->true().
[MAILPOET-5664]
2023-10-24 08:58:22 +03:00
Rodrigo Primo
afe378ba22
Replace expect()->equals() with verify()->equals()
...
codeception/verify 2.1 removed support for expect()->equals() so we need
to replace it with verify()->equals().
[MAILPOET-5664]
2023-10-24 08:58:22 +03:00
Rodrigo Primo
7a82270769
Add types to verifyWPSubscriber() based on PR reviewer feedback
...
[MAILPOET-4370]
2023-05-30 13:12:29 +02:00
Rodrigo Primo
bb2c77de31
Simplify verifyMailpoetSubscriber() by setting types in the signature
...
[MAILPOET-4370]
2023-05-30 13:12:29 +02:00
Rodrigo Primo
06a2c4e2bc
Refactor Scheduler to use SubscriberEntity instead of Subscriber model
...
It was necessary to add a call to SubscribersRepository::remove() to two
integration tests to make sure Doctrine cleared its internal cache.
Maybe this should be handled by SubscribersRepository::bulkDelete().
[MAILPOET-4370]
2023-05-30 13:12:29 +02:00
Rodrigo Primo
b251fa8ee9
Replace SubscribeSegment model with Doctrine code in Scheduler
...
[MAILPOET-4370]
2023-05-30 13:12:29 +02:00
Rodrigo Primo
3b46668784
Refactor processScheduledStandardNewsletter() to use Doctrine
...
[MAILPOET-4370]
2023-05-30 13:12:29 +02:00
Rodrigo Primo
ca3b5032ca
Replace Newsletter model with NewsletterEntity in SchedulerTest
...
Temporary code was added to Scheduler to make some of its methods work
both with a Newsletter model and a NewsletterEntity.
[MAILPOET-4370]
2023-05-30 13:12:29 +02:00
Rodrigo Primo
1a036b8772
Use constants from NewsletterEntity instead of Newsletter model in SchedulerTest
...
[MAILPOET-4370]
2023-05-18 14:48:02 -03:00
Rodrigo Primo
fb9cfe24ce
Replace ScheduledTask model with ScheduledTaskEntity in SchedulerTest
...
[MAILPOET-4370]
2023-05-18 14:48:02 -03:00
Rodrigo Primo
7001b18858
Replace ScheduledTaskSubscribe model with ScheduledTaskSubscriberEntity in SchedulerTest
...
[MAILPOET-4370]
2023-05-18 14:48:02 -03:00
Rodrigo Primo
54b135d9c1
Replace NewsletterSegment model with NewsletterSegmentEntity in SchedulerTest
...
[MAILPOET-4370]
2023-05-18 14:48:02 -03:00
Rodrigo Primo
c3cb29c195
Replace SendingQueue model with SendingQueueEntity in SchedulerTest
...
[MAILPOET-4370]
2023-05-18 14:48:02 -03:00
Rodrigo Primo
51fe832592
Replace Segment model with SegmentEntity in SchedulerTest
...
[MAILPOET-4370]
2023-05-18 14:48:02 -03:00
Rodrigo Primo
661690cc10
Replace Subscriber model with SubscriberEntity in SchedulerTest
...
[MAILPOET-4370]
2023-05-18 14:48:02 -03:00
Rodrigo Primo
7e49ef3001
Replace SubscriberSegment model with SubscriberSegmentEntity in SchedulerTest
...
[MAILPOET-4370]
2023-05-18 14:48:02 -03:00
Jan Jakes
69f21814e3
Rename "transactional" email type to "automation_transactional"
...
[MAILPOET-5258]
2023-04-24 09:54:08 +03:00
David Remer
9afe052b2a
Test transactional emails get scheduled
...
[MAILPOET-4999]
2023-04-17 13:59:39 +02:00
Jan Jakes
b296e40077
Extract Carbon datetime reset to test bootstrap
...
MAILPOET-5145
2023-04-07 12:11:12 -05:00
Jan Jakes
70e6447e28
Extract WPFunctions reset to test bootstrap
...
MAILPOET-5145
2023-04-07 12:11:12 -05:00