Fix tests after last changes
[MAILPOET-4639]
This commit is contained in:
@ -76,7 +76,7 @@ class MailPoetMapper {
|
|||||||
$resultParsed = json_decode($result['message'], true);
|
$resultParsed = json_decode($result['message'], true);
|
||||||
$message = __('Error while sending.', 'mailpoet');
|
$message = __('Error while sending.', 'mailpoet');
|
||||||
if (!is_array($resultParsed)) {
|
if (!is_array($resultParsed)) {
|
||||||
if ($result['error'] === API::ERROR_MESSAGE_DMRAC) {
|
if (isset($result['error']) && $result['error'] === API::ERROR_MESSAGE_DMRAC) {
|
||||||
$message .= $this->getDmarcMessage($result, $sender);
|
$message .= $this->getDmarcMessage($result, $sender);
|
||||||
} else {
|
} else {
|
||||||
$message .= ' ' . $result['message'];
|
$message .= ' ' . $result['message'];
|
||||||
|
@ -304,7 +304,8 @@ class MailPoetAPITest extends \MailPoetTest {
|
|||||||
['sendMessages' => [
|
['sendMessages' => [
|
||||||
'code' => API::RESPONSE_CODE_CAN_NOT_SEND,
|
'code' => API::RESPONSE_CODE_CAN_NOT_SEND,
|
||||||
'status' => API::SENDING_STATUS_SEND_ERROR,
|
'status' => API::SENDING_STATUS_SEND_ERROR,
|
||||||
'message' => MailerError::MESSAGE_EMAIL_NOT_AUTHORIZED,
|
'message' => API::ERROR_MESSAGE_INVALID_FROM,
|
||||||
|
'error' => API::ERROR_MESSAGE_INVALID_FROM,
|
||||||
]]
|
]]
|
||||||
);
|
);
|
||||||
$mailer->send([$this->newsletter], [$this->subscriber]);
|
$mailer->send([$this->newsletter], [$this->subscriber]);
|
||||||
|
@ -74,7 +74,8 @@ class MailPoetMapperTest extends \MailPoetUnitTest {
|
|||||||
$apiResult = [
|
$apiResult = [
|
||||||
'code' => API::RESPONSE_CODE_CAN_NOT_SEND,
|
'code' => API::RESPONSE_CODE_CAN_NOT_SEND,
|
||||||
'status' => API::SENDING_STATUS_SEND_ERROR,
|
'status' => API::SENDING_STATUS_SEND_ERROR,
|
||||||
'message' => MailerError::MESSAGE_EMAIL_FORBIDDEN_ACTION,
|
'message' => API::ERROR_MESSAGE_BANNED,
|
||||||
|
'error' => API::ERROR_MESSAGE_BANNED,
|
||||||
];
|
];
|
||||||
$error = $this->mapper->getErrorForResult($apiResult, $this->subscribers);
|
$error = $this->mapper->getErrorForResult($apiResult, $this->subscribers);
|
||||||
|
|
||||||
@ -88,7 +89,8 @@ class MailPoetMapperTest extends \MailPoetUnitTest {
|
|||||||
$apiResult = [
|
$apiResult = [
|
||||||
'code' => API::RESPONSE_CODE_CAN_NOT_SEND,
|
'code' => API::RESPONSE_CODE_CAN_NOT_SEND,
|
||||||
'status' => API::SENDING_STATUS_SEND_ERROR,
|
'status' => API::SENDING_STATUS_SEND_ERROR,
|
||||||
'message' => MailerError::MESSAGE_EMAIL_INSUFFICIENT_PRIVILEGES,
|
'message' => API::ERROR_MESSAGE_INSUFFICIENT_PRIVILEGES,
|
||||||
|
'error' => API::ERROR_MESSAGE_INSUFFICIENT_PRIVILEGES,
|
||||||
];
|
];
|
||||||
$error = $this->mapper->getErrorForResult($apiResult, $this->subscribers);
|
$error = $this->mapper->getErrorForResult($apiResult, $this->subscribers);
|
||||||
|
|
||||||
@ -102,7 +104,8 @@ class MailPoetMapperTest extends \MailPoetUnitTest {
|
|||||||
$apiResult = [
|
$apiResult = [
|
||||||
'code' => API::RESPONSE_CODE_CAN_NOT_SEND,
|
'code' => API::RESPONSE_CODE_CAN_NOT_SEND,
|
||||||
'status' => API::SENDING_STATUS_SEND_ERROR,
|
'status' => API::SENDING_STATUS_SEND_ERROR,
|
||||||
'message' => MailerError::MESSAGE_EMAIL_NOT_AUTHORIZED,
|
'message' => API::ERROR_MESSAGE_INVALID_FROM,
|
||||||
|
'error' => API::ERROR_MESSAGE_INVALID_FROM,
|
||||||
];
|
];
|
||||||
$error = $this->mapper->getErrorForResult($apiResult, $this->subscribers);
|
$error = $this->mapper->getErrorForResult($apiResult, $this->subscribers);
|
||||||
|
|
||||||
@ -174,7 +177,8 @@ class MailPoetMapperTest extends \MailPoetUnitTest {
|
|||||||
$apiResult = [
|
$apiResult = [
|
||||||
'code' => API::RESPONSE_CODE_CAN_NOT_SEND,
|
'code' => API::RESPONSE_CODE_CAN_NOT_SEND,
|
||||||
'status' => API::SENDING_STATUS_SEND_ERROR,
|
'status' => API::SENDING_STATUS_SEND_ERROR,
|
||||||
'message' => MailerError::MESSAGE_PENDING_APPROVAL,
|
'message' => API::ERROR_MESSAGE_PENDING_APPROVAL,
|
||||||
|
'error' => API::ERROR_MESSAGE_PENDING_APPROVAL,
|
||||||
];
|
];
|
||||||
$error = $this->mapper->getErrorForResult($apiResult, $this->subscribers);
|
$error = $this->mapper->getErrorForResult($apiResult, $this->subscribers);
|
||||||
expect($error)->isInstanceOf(MailerError::class);
|
expect($error)->isInstanceOf(MailerError::class);
|
||||||
|
Reference in New Issue
Block a user