diff --git a/tests/unit/Cron/Workers/SendingQueue/SendingQueueTest.php b/tests/unit/Cron/Workers/SendingQueue/SendingQueueTest.php index df6a38c944..32f43fefd2 100644 --- a/tests/unit/Cron/Workers/SendingQueue/SendingQueueTest.php +++ b/tests/unit/Cron/Workers/SendingQueue/SendingQueueTest.php @@ -1,5 +1,6 @@ subscriber->save(); $this->newsletter = Newsletter::create(); $this->newsletter->type = Newsletter::TYPE_STANDARD; - $this->newsletter->subject = 'Newsletter for [subscriber:firstname]'; - $this->newsletter->body = ' - { - "content": { - "type": "container", - "orientation": "vertical", - "blocks": [ - { - "type": "container", - "styles": { "block": {} }, - "orientation": "horizontal", - "blocks": [ - { - "type": "container", - "orientation": "vertical", - "styles": { "block": {} }, - "blocks": [ - { - "type": "text", - "text": "Sample newsletter" - } - ] - } - ] - } - ] - } - }'; + $this->newsletter->subject = Fixtures::get('newsletter_subject_template'); + $this->newsletter->body = Fixtures::get('newsletter_body_template'); $this->newsletter->save(); $this->queue = SendingQueue::create(); $this->queue->newsletter_id = $this->newsletter->id; diff --git a/tests/unit/Cron/Workers/SendingQueue/Tasks/NewsletterTest.php b/tests/unit/Cron/Workers/SendingQueue/Tasks/NewsletterTest.php index 9fc05c95f7..73a6a3130f 100644 --- a/tests/unit/Cron/Workers/SendingQueue/Tasks/NewsletterTest.php +++ b/tests/unit/Cron/Workers/SendingQueue/Tasks/NewsletterTest.php @@ -1,4 +1,5 @@ subscriber->first_name = 'John'; $this->subscriber->last_name = 'Doe'; $this->subscriber->save(); - $this->post_id = 10; $this->newsletter = Newsletter::create(); $this->newsletter->type = Newsletter::TYPE_STANDARD; - $this->newsletter->subject = 'Newsletter for [subscriber:firstname]'; - $this->newsletter->body = ' - { - "content": { - "type": "container", - "orientation": "vertical", - "blocks": [ - { - "type": "container", - "styles": { "block": {} }, - "orientation": "horizontal", - "blocks": [ - { - "type": "container", - "orientation": "vertical", - "styles": { "block": {} }, - "blocks": [ - { - "type": "text", - "text": "post_id . '\" href=\"http://example.com\">LinkHello [subscriber:firstname]" - } - ] - } - ] - } - ] - } - }'; + $this->newsletter->subject = Fixtures::get('newsletter_subject_template'); + $this->newsletter->body = Fixtures::get('newsletter_body_template'); $this->newsletter->save(); $this->queue = SendingQueue::create(); $this->queue->newsletter_id = $this->newsletter->id; @@ -115,7 +89,7 @@ class NewsletterTaskTest extends MailPoetTest { $newsletter_post = NewsletterPost::where('newsletter_id', $this->newsletter->id) ->findOne(); expect($result)->notEquals(false); - expect($newsletter_post->post_id)->equals($this->post_id); + expect($newsletter_post->post_id)->equals('10'); } function testItUpdatesStatusToSentOnlyForStandardNewsletters() { diff --git a/tests/unit/_bootstrap.php b/tests/unit/_bootstrap.php index b3d9bbc7f3..b282bf6d30 100644 --- a/tests/unit/_bootstrap.php +++ b/tests/unit/_bootstrap.php @@ -1 +1,37 @@ LinkHello [subscriber:firstname]" + } + ] + } + ] + } + ] + } + }' +); + +Fixtures::add( + 'newsletter_subject_template', + 'Newsletter for [subscriber:firstname]' +);