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]
This test is being removed as the field source of the table
wp_mailpoet_subscribers does not accept a null value. When changing the
test class MetaInfoTest from Paris to Doctrine, there is no easy way to
set subscriber source to null and since it is not possible to store this
value in the database anyway, it seems to me this test is not necessary.
I'm opting to keep the code in MetaInfo that sets `subscriber_source` to
`unknown` if the subscriber source is null
(9f790efbf0/mailpoet/lib/Mailer/MetaInfo.php (L64))
just in case this is still possible in some old databases (which I don't
think is the case).
[MAILPOET-4379]