Commit Graph

20468 Commits

Author SHA1 Message Date
Rodrigo Primo
69736c5e83 Fix typo in error message
[MAILPOET-4368]
2023-10-25 21:09:39 +02:00
Rodrigo Primo
508fdd7756 Refresh Doctrine entities in SendingQueue::add() to avoid issues
Since SendingQueue::add() still uses Paris, it was running into some
problems caught by our integration tests since some Sending methods
where refactored to Doctrine. The issue was that we started loading some
Doctrine entities earlier, then Paris code inside SendingQueue::add()
would change the same rows, causing the Doctrine entities to contain
stale data. To workaround this problem, in this commit, we are making
sure that the Doctrine entities are refreshed after they are changed by
Paris.

I considered refactoring SendingQueue::add() to use Doctrine but I
wasn't sure what to do with SendingTask::create() and
SendingTask::createFromQueue() so I decided to take a different
approach.

[MAILPOET-4368]
2023-10-25 21:09:39 +02:00
Rodrigo Primo
dc1cee5118 Replace Newsletter model with NewsletterEntity in SendingQueue
This was the easiest way to fix failing integration tests related to
updating some Sending methods to use Doctrine instead of Paris. Using
Paris in SendingQueue to update the database was creating a state where
Doctrine had stale data and this was causing the tests to fail.

[MAILPOET-4368]
2023-10-25 21:09:39 +02:00
Rodrigo Primo
18d34202a8 Remove remaining uses of the ScheduledTaskSubscriber model from Sending
[MAILPOET-4368]
2023-10-25 21:09:39 +02:00
Rodrigo Primo
63a0f0b940 Remove \MailPoet\Tasks\Subscribers class now that it is not used anymore
[MAILPOET-4368]
2023-10-25 21:09:39 +02:00
Rodrigo Primo
8b4e747499 Refactor Sending::saveSubscriberError() to use Doctrine instead of Paris
[MAILPOET-4368]
2023-10-25 21:09:39 +02:00
Rodrigo Primo
11f8de4176 Add integration test for Sending::saveSubscriberError()
[MAILPOET-4368]
2023-10-25 21:09:39 +02:00
Rodrigo Primo
d5cb060cb5 Refactor Sending::delete() to use Doctrine instead of Paris
[MAILPOET-4368]
2023-10-25 21:09:39 +02:00
Rodrigo Primo
2b368141db Refactor updateProcessedSubscribers() to use Doctrine instead of Paris
It was necessary to update a test to be more lenient when comparing
dates and another one to persist a change in Paris to the database.

[MAILPOET-4368]
2023-10-25 21:09:39 +02:00
Rodrigo Primo
c0a091de04 Add the ScheduledTaskEntity as a property to the Sending class
Doing this instead of having to get the ScheduledTaskEntity in several
methods of this class.

[MAILPOET-4368]
2023-10-25 21:09:39 +02:00
Rodrigo Primo
9f48427b1c Update test coverage for updateProcessedSubscribers()
[MAILPOET-4368]
2023-10-25 21:09:39 +02:00
Rodrigo Primo
4e633f64fb Remove unused method removeAllSubscribers()
This method was added in c0c57f6b67 but
its only usage besides integration test was removed in
18a6a1c439. It doesn't seem like it is
still used in our code base.

[MAILPOET-4368]
2023-10-25 21:09:39 +02:00
Rodrigo Primo
fefaf174cd Refactor Sending::removeSubscribers() to use Doctrine instead of Paris
[MAILPOET-4368]
2023-10-25 21:09:39 +02:00
Rodrigo Primo
59d4ce3ba2 Update checkCompleted() to also change the processedAt field
This commit updates the method ScheduledTaskSubscribersRepository::checkCompleted() to update the processedAt field of the Scheduled Task. The method was added in f62d9b4167 and I believe it is meant to be a replacement to \MailPoet\Tasks\Subscribers::checkCompleted(). The original method updates the processedAt field, so I'm assuming the new method should update as well. I found this while working on refactoring \MailPoet\Tasks\Sending::removeSubscribers() to use Doctrine as this method calls \MailPoet\Tasks\Subscribers::checkCompleted() internaly.

[MAILPOET-4368]
2023-10-25 21:09:39 +02:00
Rodrigo Primo
9c766c2f32 Fix typo
[MAILPOET-4368]
2023-10-25 21:09:39 +02:00
Rodrigo Primo
6b56a3ab7f Improve test coverage for Sending::removeSubscribers()
[MAILPOET-4368]
2023-10-25 21:09:39 +02:00
veljko
d8da748b7b Updated selectors for k6 test to reflect new segmentation
[MAILPOET-5675]
2023-10-25 13:32:52 +02:00
Rodrigo Primo
57129bd460 Deprecate \MailPoet\Models\ScheduledTaskSubscriber::setSubscribers()
This model is no longer used since Sending::setSubscribers() was
refactored in a previous commit.

[MAILPOET-4368]
2023-10-25 10:31:45 +02:00
Rodrigo Primo
8fd8b8f193 Refactor Sending::setSubscribers() to use Doctrine instead of Paris
[MAILPOET-4368]
2023-10-25 10:31:45 +02:00
Rodrigo Primo
b252043dac Refactor Sending::getSubscribers() to use Doctrine instead of Paris
[MAILPOET-4368]
2023-10-25 10:31:45 +02:00
Rodrigo Primo
eb16cca0da Improve test coverage for Sending::getSubscribers()
[MAILPOET-4368]
2023-10-25 10:31:45 +02:00
Rodrigo Primo
52ebb9562c Replace ScheduledTaskSubscriber model with corresponding entity in SendingTest
[MAILPOET-4368]
2023-10-25 10:31:45 +02:00
Rodrigo Primo
6488bd5fd4 Replace Newsletter model with Newsletter entity in SendingTest
[MAILPOET-4368]
2023-10-25 10:31:45 +02:00
Pavel Dohnal
52195fc3f9 Release 4.34.0 2023-10-25 10:20:55 +02:00
Pavel Dohnal
b60da9faf6 Make sure offset is always number
We want to prevent an error 'Unsupported operand types: string * int'

[MAILPOET-5676]
2023-10-24 16:12:24 +02:00
Pavel Dohnal
8f1cdc6a0d Release 4.33.0 2023-10-24 12:27:35 +02:00
Rodrigo Primo
5fec40484a Remove PHPStan ignored error that is not happening anymore
This error was added to the list of PHPStan ignored errors in
153e32b3bc. It is not happening anymore so
it is safe to remove it. Probably one of the commits that changed the
used codeception/verify functions caused that but I didn't check which
one and I don't believe this is necessary.

[MAILPOET-5664]
2023-10-24 08:58:22 +03:00
Rodrigo Primo
2455388f8d Replace expect()->matchesFormat() with verify()->stringMatchesFormat()
codeception/verify 2.1 removed support for expect()->matchesFormat() so we need
to replace it with verify()->stringMatchesFormat().

[MAILPOET-5664]
2023-10-24 08:58:22 +03:00
Rodrigo Primo
560f728713 Replace expect()->string() with verify()->isString()
codeception/verify 2.1 removed support for expect()->string() so we need
to replace it with verify()->isString().

[MAILPOET-5664]
2023-10-24 08:58:22 +03:00
Rodrigo Primo
4f90774bec Replace expect()->int() with verify()->isInt()
codeception/verify 2.1 removed support for expect()->int() so we need
to replace it with verify()->isInt().

[MAILPOET-5664]
2023-10-24 08:58:22 +03:00
Rodrigo Primo
65e4fe3b9f Replace expect()->callable() with verify()->isCallable()
codeception/verify 2.1 removed support for expect()->callable() so we need
to replace it with verify()->isCallable().

[MAILPOET-5664]
2023-10-24 08:58:22 +03:00
Rodrigo Primo
73445afd70 Replace expect_that() with verify()->instanceOf()
codeception/verify 2.1 removed support for expect_that() so we need
to replace it with verify()->instanceOf().

[MAILPOET-5664]
2023-10-24 08:58:22 +03:00
Rodrigo Primo
eb8351f964 Replace verify()->equals() with verify->equalsWithDelta()
The second parameter of expect()->equals() could be a integer and in
this case it would be used as a delta when comparing the values.
verify()->equals() does not accept that and verify()->equalsWithDelta()
should be used.

[MAILPOET-5664]
2023-10-24 08:58:22 +03:00
Rodrigo Primo
fac7fbb4f1 Replace expect()->notContains() with verify()->arrayNotContains()
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
8bc4d78c68 Replace expect()->regExp() with verify()->stringMatchesRegExp()
codeception/verify 2.1 removed support for expect()->regExp() so we need
to replace it with verify()->stringMatchesRegExp().

[MAILPOET-5664]
2023-10-24 08:58:22 +03: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
c1c59fe392 Replace expect()->lessOrEquals() with verify()->lessThanOrEqual()
codeception/verify 2.1 removed support for expect()->lessOrEquals() so we need
to replace it with verify()->lessThanOrEqual().

[MAILPOET-5664]
2023-10-24 08:58:22 +03:00
Rodrigo Primo
e4f0b89032 Replace expect()->contains() with verify()->arrayContains()
codeception/verify 2.1 removed support for expect()->contains() so we need
to replace it with verify()->arrayContains().

[MAILPOET-5664]
2023-10-24 08:58:22 +03:00
Rodrigo Primo
fa9236d8c9 Replace expect()->greaterThan() with verify()->greaterThan()
codeception/verify 2.1 removed support for expect()->greaterThan() so we need
to replace it with verify()->greaterThan().

[MAILPOET-5664]
2023-10-24 08:58:22 +03:00
Rodrigo Primo
b5b4106da4 Replace expect()->endsWith() with verify()->stringEndsWith()
codeception/verify 2.1 removed support for expect()->endsWith() so we need
to replace it with verify()->stringEndsWith().

[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
a1f57361c5 Replace expect()->array() with verify()->isArray()
codeception/verify 2.1 removed support for expect()->array() so we need
to replace it with verify()->isArray().

[MAILPOET-5664]
2023-10-24 08:58:22 +03:00
Rodrigo Primo
c41e5c7d0f Replace expect()->hasNotKey() with verify()->arrayHasNotKey()
codeception/verify 2.1 removed support for expect()->hasNotKey() so we need
to replace it with verify()->arrayHasNotKey().

[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
1865fc8930 Replace expect()->isInstanceOf() with verify()->instanceOf()
codeception/verify 2.1 removed support for expect()->isInstanceOf() so we need
to replace it with verify()->instanceOf().

[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