Prevent activating email without body
[MAILPOET-2366]
This commit is contained in:
committed by
Jack Kitterhing
parent
e56a654b2b
commit
35c9973c85
@@ -899,6 +899,7 @@ class NewsletterTest extends \MailPoetTest {
|
||||
foreach ($newsletters_with_activation as $type) {
|
||||
$newsletter = Newsletter::createOrUpdate([
|
||||
'type' => $type,
|
||||
'body' => '["x", "y"]',
|
||||
]);
|
||||
$task = ScheduledTask::createOrUpdate([
|
||||
'status' => ScheduledTask::STATUS_PAUSED,
|
||||
@@ -914,6 +915,17 @@ class NewsletterTest extends \MailPoetTest {
|
||||
}
|
||||
}
|
||||
|
||||
function testBlocksActivationOfEmptyNewsletter() {
|
||||
$newsletter = Newsletter::createOrUpdate([
|
||||
'type' => Newsletter::TYPE_NOTIFICATION,
|
||||
'body' => '[]',
|
||||
'status' => Newsletter::STATUS_DRAFT,
|
||||
]);
|
||||
$newsletter = $newsletter->setStatus(Newsletter::STATUS_ACTIVE);
|
||||
expect($newsletter->status)->equals(Newsletter::STATUS_DRAFT);
|
||||
expect($newsletter->getErrors())->notEmpty();
|
||||
}
|
||||
|
||||
function _after() {
|
||||
\ORM::raw_execute('TRUNCATE ' . NewsletterOption::$_table);
|
||||
\ORM::raw_execute('TRUNCATE ' . Newsletter::$_table);
|
||||
|
Reference in New Issue
Block a user