Use data factory for test newsletter
MAILPOET-4236
This commit is contained in:
committed by
Veljko V
parent
0159418251
commit
780dd7f609
@ -1471,11 +1471,6 @@ parameters:
|
|||||||
count: 1
|
count: 1
|
||||||
path: ../../tests/acceptance/Subscribers/SubscriberCookieCest.php
|
path: ../../tests/acceptance/Subscribers/SubscriberCookieCest.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$body of method MailPoet\\\\Entities\\\\NewsletterEntity\\:\\:setBody\\(\\) expects array\\|null, mixed given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../../tests/integration/API/JSON/v1/SendingQueueTest.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Parameter \\#1 \\$needle of method Codeception\\\\Verify\\\\Verify\\:\\:stringContainsString\\(\\) expects string, mixed given\\.$#"
|
message: "#^Parameter \\#1 \\$needle of method Codeception\\\\Verify\\\\Verify\\:\\:stringContainsString\\(\\) expects string, mixed given\\.$#"
|
||||||
count: 4
|
count: 4
|
||||||
|
@ -1476,11 +1476,6 @@ parameters:
|
|||||||
count: 1
|
count: 1
|
||||||
path: ../../tests/acceptance/Subscribers/SubscriberCookieCest.php
|
path: ../../tests/acceptance/Subscribers/SubscriberCookieCest.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$body of method MailPoet\\\\Entities\\\\NewsletterEntity\\:\\:setBody\\(\\) expects array\\|null, mixed given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../../tests/integration/API/JSON/v1/SendingQueueTest.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Parameter \\#1 \\$needle of method Codeception\\\\Verify\\\\Verify\\:\\:stringContainsString\\(\\) expects string, mixed given\\.$#"
|
message: "#^Parameter \\#1 \\$needle of method Codeception\\\\Verify\\\\Verify\\:\\:stringContainsString\\(\\) expects string, mixed given\\.$#"
|
||||||
count: 4
|
count: 4
|
||||||
|
@ -1505,11 +1505,6 @@ parameters:
|
|||||||
count: 1
|
count: 1
|
||||||
path: ../../tests/acceptance/Subscribers/SubscriberCookieCest.php
|
path: ../../tests/acceptance/Subscribers/SubscriberCookieCest.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$body of method MailPoet\\\\Entities\\\\NewsletterEntity\\:\\:setBody\\(\\) expects array\\|null, mixed given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../../tests/integration/API/JSON/v1/SendingQueueTest.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Parameter \\#1 \\$needle of method Codeception\\\\Verify\\\\Verify\\:\\:stringContainsString\\(\\) expects string, mixed given\\.$#"
|
message: "#^Parameter \\#1 \\$needle of method Codeception\\\\Verify\\\\Verify\\:\\:stringContainsString\\(\\) expects string, mixed given\\.$#"
|
||||||
count: 4
|
count: 4
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace MailPoet\Test\API\JSON\v1;
|
namespace MailPoet\Test\API\JSON\v1;
|
||||||
|
|
||||||
use Codeception\Util\Fixtures;
|
|
||||||
use Codeception\Util\Stub;
|
use Codeception\Util\Stub;
|
||||||
use MailPoet\API\JSON\Response as APIResponse;
|
use MailPoet\API\JSON\Response as APIResponse;
|
||||||
use MailPoet\API\JSON\v1\SendingQueue as SendingQueueAPI;
|
use MailPoet\API\JSON\v1\SendingQueue as SendingQueueAPI;
|
||||||
@ -29,12 +28,10 @@ class SendingQueueTest extends \MailPoetTest {
|
|||||||
parent::_before();
|
parent::_before();
|
||||||
$this->clean();
|
$this->clean();
|
||||||
|
|
||||||
$this->newsletter = new NewsletterEntity();
|
$this->newsletter = (new Newsletter())
|
||||||
$this->newsletter->setSubject('My Standard Newsletter');
|
->withSubject('My Standard Newsletter')
|
||||||
$this->newsletter->setBody(json_decode(Fixtures::get('newsletter_body_template'), true));
|
->withDefaultBody()
|
||||||
$this->newsletter->setType(NewsletterEntity::TYPE_STANDARD);
|
->create();
|
||||||
$this->entityManager->persist($this->newsletter);
|
|
||||||
$this->entityManager->flush();
|
|
||||||
|
|
||||||
$settings = SettingsController::getInstance();
|
$settings = SettingsController::getInstance();
|
||||||
$settings->set('sender', [
|
$settings->set('sender', [
|
||||||
@ -128,11 +125,10 @@ class SendingQueueTest extends \MailPoetTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function testItRejectsInvalidNewsletters() {
|
public function testItRejectsInvalidNewsletters() {
|
||||||
$newsletter = (new Newsletter())->create();
|
|
||||||
$sendingQueue = $this->getServiceWithOverrides(SendingQueueAPI::class, [
|
$sendingQueue = $this->getServiceWithOverrides(SendingQueueAPI::class, [
|
||||||
'newsletterValidator' => Stub::make(NewsletterValidator::class, ['validate' => 'some error'])
|
'newsletterValidator' => Stub::make(NewsletterValidator::class, ['validate' => 'some error'])
|
||||||
]);
|
]);
|
||||||
$response = $sendingQueue->add(['newsletter_id' => $newsletter->getId()]);
|
$response = $sendingQueue->add(['newsletter_id' => $this->newsletter->getId()]);
|
||||||
$response = $response->getData();
|
$response = $response->getData();
|
||||||
expect($response['errors'][0])->array();
|
expect($response['errors'][0])->array();
|
||||||
expect($response['errors'][0]['message'])->stringContainsString('some error');
|
expect($response['errors'][0]['message'])->stringContainsString('some error');
|
||||||
|
Reference in New Issue
Block a user