Commit Graph

14 Commits

Author SHA1 Message Date
Jan Jakes
723dc2c9d3 Fix type errors in tests
[MAILPOET-2688]
2022-11-29 15:04:09 +01:00
Jan Jakes
82aeb89854 Use strict types in tests
[MAILPOET-2688]
2022-11-29 15:04:09 +01:00
David Remer
7db40b27b5 Fix errors automatically with phpcbf
[MAILPOET-4850]
2022-11-28 22:54:13 +03:00
David Remer
d2ec7bba42 Replace instance_of asserts in integration tests
[MAILPOET-4258]
2022-11-25 14:32:34 +01:00
Rodrigo Primo
f4053b0583 Stop using a mock of NewslettersRepository to prevent errors in tests
This commit changes the SendingQueueTest test class to always use a real
NewslettersRepository object instead of a mock object when instantiating
SendingQueue. This is necessary to prevent false errors in the tests.

Using a mock of the NewslettersRepository in this test class means that
all code inside SendingQueue that uses this repository could behave in
unpredictable ways. As it was happening with a few tests incorrectly
failing after dd6e02e2c16a3a0ef7ad2c12479917e33c312c77:

https://app.circleci.com/pipelines/github/mailpoet/mailpoet/11132/workflows/7b4df151-5a10-48f0-9711-dd590a764880/jobs/192389/tests#failed-test-0

In this case, the code was not changing the status of the newsletter
because findOneById() was returning an empty Newsletter entity instead
of the real Newsletter entity that corresponds to the object in the
database. And, thus, $newsletter->getType() was returning `null` instead
of `standard`.

This problem was already partially addressed in the commit below that
removed some of the usages of the NewslettersRepository mock:

5042cdd15e

[MAILPOET-4363]
2022-09-21 16:03:21 +02:00
Rostislav Wolny
5042cdd15e Refactor fetching newsletter options in SendingQueue using doctrine
[MAILPOET-4511]
2022-07-29 10:33:05 +02:00
Rodrigo Primo
932512b720 Replace Paris models with Doctrine entities in MetaInfoTest
In the process it was necessary to change the signature of the method
\MailPoet\Mailer\MetaInfo::getNewsletterMetaInfo() to accept a
SubscriberEntity instead of a Subscriber model and also change
\MailPoet\Cron\Workers\SendingQueue\SendingQueue::processQueue() as it
calls getNewsletterMetaInfo().

Doing this was straightforward, but changing the test class for
SendingQueue was a bit more involved. In particular, the test
SendingQueueTest::testItEnforcesExecutionLimitsAfterQueueProcessing().

This test is a bit brittle and was creating Subscriber models without
saving them to the database with invalid statuses and sources. Switching
getNewsletterMetaInfo() to use entities, while
SendingQueue::processQueue() still uses models, meant that it was
necessary to save the subscribers to the database. Because of this, it
was not possible anymore to use invalid statuses and sources, and
thus, the test changed a bit.

[MAILPOET-4379]
2022-07-27 08:48:15 +02:00
Jan Lysý
1b04b43be7 Add integration test for handling sending error
[MAILPOET-4200]
2022-04-25 10:58:12 +02:00
Rostislav Wolny
b8bfa60634 Replace static Stub::xxx calls with test case methods in SendingQueueTest
[MAILPOET-4115]
2022-04-11 16:54:38 +02:00
Rostislav Wolny
d4a8315933 Use mailerFactory in SendingQueue Mailer task
[MAILPOET-4115]
2022-04-11 16:54:38 +02:00
Rostislav Wolny
6a6c04f168 Fetch only subscribed recipients when sending a newsletter
[MAILPOET-4166]
2022-03-07 16:05:48 +01:00
David Remer
18afeb6ab6 Use strings in MailPoet\Models\Model::set() 2022-02-09 15:07:21 +01:00
David Remer
77c1d65f4d Test: Validate personalized values in newsletters getting send out
Adds a test whether the personalized values are correct when newsletters get send out
in the SendingQueue with the processing method 'individual'. [MAILPOET-3943]
2022-02-09 15:07:21 +01:00
Jan Jakes
9f790efbf0 Move plugin files to a subfolder
[MAILPOET-3988]
2022-01-18 15:30:22 +01:00