Files
piratepoet/tests/unit/Mailer/Methods/ErrorMappers/SendGridMapperTest.php
Rostislav Wolny f5c9d0f7db Remove unnecessary test_email extra parameter for mailer->send
It was used only to prevent appending unprocessed subscribers into error message.
Since the message is now composed by on demand by MailerError the parameter is not needed any more.

[MAILPOET-1154]
2018-09-13 11:12:38 +02:00

37 lines
1.0 KiB
PHP

<?php
namespace MailPoet\Test\Mailer\Methods\ErrorMappers;
use MailPoet\Mailer\MailerError;
use MailPoet\Mailer\Methods\ErrorMappers\SendGridMapper;
class SendGridMapperTest extends \MailPoetTest {
/** @var SendGridMapper*/
private $mapper;
/** @var array */
private $response = [];
function _before() {
$this->mapper = new SendGridMapper();
$this->response = [
'errors' => [
'Some message',
]
];
}
function testGetProperError() {
$error = $this->mapper->getErrorFromResponse($this->response, 'john@rambo.com');
expect($error->getLevel())->equals(MailerError::LEVEL_HARD);
expect($error->getMessage())->equals('Some message');
expect($error->getSubscriberErrors()[0]->getEmail())->equals('john@rambo.com');
}
function testGetSoftErrorForInvalidEmail() {
$this->response['errors'][0] = 'Invalid email address ,,@';
$error = $this->mapper->getErrorFromResponse($this->response, ',,@');
expect($error->getLevel())->equals(MailerError::LEVEL_SOFT);
}
}