Add public keyword to methods
[MAILPOET-2413]
This commit is contained in:
@ -14,7 +14,7 @@ class AmazonSESMapperTest extends \MailPoetUnitTest {
|
||||
/** @var array */
|
||||
private $response_data = [];
|
||||
|
||||
function _before() {
|
||||
public function _before() {
|
||||
parent::_before();
|
||||
$this->mapper = new AmazonSESMapper();
|
||||
$this->response_data = [
|
||||
@ -27,7 +27,7 @@ class AmazonSESMapperTest extends \MailPoetUnitTest {
|
||||
];
|
||||
}
|
||||
|
||||
function testGetProperError() {
|
||||
public function testGetProperError() {
|
||||
$response = $this->buildXmlResponseFromArray($this->response_data, new SimpleXMLElement('<response/>'));
|
||||
$error = $this->mapper->getErrorFromResponse($response, 'john@rambo.com');
|
||||
expect($error->getLevel())->equals(MailerError::LEVEL_HARD);
|
||||
@ -35,7 +35,7 @@ class AmazonSESMapperTest extends \MailPoetUnitTest {
|
||||
expect($error->getSubscriberErrors()[0]->getEmail())->equals('john@rambo.com');
|
||||
}
|
||||
|
||||
function testGetSoftErrorForRejectedMessage() {
|
||||
public function testGetSoftErrorForRejectedMessage() {
|
||||
$this->response_data['Error']['Code'] = 'MessageRejected';
|
||||
$response = $this->buildXmlResponseFromArray($this->response_data, new SimpleXMLElement('<response/>'));
|
||||
$error = $this->mapper->getErrorFromResponse($response, 'john@rambo.com');
|
||||
|
@ -13,13 +13,13 @@ class MailPoetMapperTest extends \MailPoetUnitTest {
|
||||
/** @var array */
|
||||
private $subscribers;
|
||||
|
||||
function _before() {
|
||||
public function _before() {
|
||||
parent::_before();
|
||||
$this->mapper = new MailPoetMapper();
|
||||
$this->subscribers = ['a@example.com', 'c d <b@example.com>'];
|
||||
}
|
||||
|
||||
function testCreateBlacklistError() {
|
||||
public function testCreateBlacklistError() {
|
||||
$error = $this->mapper->getBlacklistError($this->subscribers[1]);
|
||||
expect($error)->isInstanceOf(MailerError::class);
|
||||
expect($error->getOperation())->equals(MailerError::OPERATION_SEND);
|
||||
@ -28,7 +28,7 @@ class MailPoetMapperTest extends \MailPoetUnitTest {
|
||||
expect($error->getMessage())->contains('MailPoet');
|
||||
}
|
||||
|
||||
function testCreateConnectionError() {
|
||||
public function testCreateConnectionError() {
|
||||
$error = $this->mapper->getConnectionError('connection error');
|
||||
expect($error)->isInstanceOf(MailerError::class);
|
||||
expect($error->getOperation())->equals(MailerError::OPERATION_CONNECT);
|
||||
@ -36,7 +36,7 @@ class MailPoetMapperTest extends \MailPoetUnitTest {
|
||||
expect($error->getMessage())->equals('connection error');
|
||||
}
|
||||
|
||||
function testGetErrorNotArray() {
|
||||
public function testGetErrorNotArray() {
|
||||
$api_result = [
|
||||
'code' => API::RESPONSE_CODE_NOT_ARRAY,
|
||||
'status' => API::SENDING_STATUS_SEND_ERROR,
|
||||
@ -50,7 +50,7 @@ class MailPoetMapperTest extends \MailPoetUnitTest {
|
||||
expect($error->getMessage())->equals('JSON input is not an array');
|
||||
}
|
||||
|
||||
function testGetErrorBannedAccount() {
|
||||
public function testGetErrorBannedAccount() {
|
||||
$api_result = [
|
||||
'code' => API::RESPONSE_CODE_CAN_NOT_SEND,
|
||||
'status' => API::SENDING_STATUS_SEND_ERROR,
|
||||
@ -64,7 +64,7 @@ class MailPoetMapperTest extends \MailPoetUnitTest {
|
||||
expect($error->getMessage())->contains('The MailPoet Sending Service has stopped sending your emails for one of the following reasons');
|
||||
}
|
||||
|
||||
function testGetErrorUnauthorizedEmail() {
|
||||
public function testGetErrorUnauthorizedEmail() {
|
||||
$api_result = [
|
||||
'code' => API::RESPONSE_CODE_CAN_NOT_SEND,
|
||||
'status' => API::SENDING_STATUS_SEND_ERROR,
|
||||
@ -78,7 +78,7 @@ class MailPoetMapperTest extends \MailPoetUnitTest {
|
||||
expect($error->getMessage())->contains('The MailPoet Sending Service did not send your latest email because the address');
|
||||
}
|
||||
|
||||
function testGetErrorPayloadTooBig() {
|
||||
public function testGetErrorPayloadTooBig() {
|
||||
$api_result = [
|
||||
'code' => API::RESPONSE_CODE_PAYLOAD_TOO_BIG,
|
||||
'status' => API::SENDING_STATUS_SEND_ERROR,
|
||||
@ -91,7 +91,7 @@ class MailPoetMapperTest extends \MailPoetUnitTest {
|
||||
expect($error->getMessage())->equals('error too big');
|
||||
}
|
||||
|
||||
function testGetPayloadError() {
|
||||
public function testGetPayloadError() {
|
||||
$api_result = [
|
||||
'code' => API::RESPONSE_CODE_PAYLOAD_ERROR,
|
||||
'status' => API::SENDING_STATUS_SEND_ERROR,
|
||||
@ -104,7 +104,7 @@ class MailPoetMapperTest extends \MailPoetUnitTest {
|
||||
expect($error->getMessage())->equals('Error while sending. Api Error');
|
||||
}
|
||||
|
||||
function testGetPayloadErrorWithErrorMessage() {
|
||||
public function testGetPayloadErrorWithErrorMessage() {
|
||||
$api_result = [
|
||||
'code' => API::RESPONSE_CODE_PAYLOAD_ERROR,
|
||||
'status' => API::SENDING_STATUS_SEND_ERROR,
|
||||
@ -122,7 +122,7 @@ class MailPoetMapperTest extends \MailPoetUnitTest {
|
||||
expect($subscriber_errors[1]->getMessage())->equals('subject is missing');
|
||||
}
|
||||
|
||||
function testGetPayloadErrorForMalformedMSSResponse() {
|
||||
public function testGetPayloadErrorForMalformedMSSResponse() {
|
||||
$api_result = [
|
||||
'code' => API::RESPONSE_CODE_PAYLOAD_ERROR,
|
||||
'status' => API::SENDING_STATUS_SEND_ERROR,
|
||||
|
@ -12,7 +12,7 @@ class PHPMailMapperTest extends \MailPoetUnitTest {
|
||||
/** @var PHPMailMapper*/
|
||||
private $mapper;
|
||||
|
||||
function _before() {
|
||||
public function _before() {
|
||||
parent::_before();
|
||||
$this->mapper = new PHPMailMapper();
|
||||
WPFunctions::set(Stub::make(new WPFunctions, [
|
||||
@ -22,26 +22,26 @@ class PHPMailMapperTest extends \MailPoetUnitTest {
|
||||
]));
|
||||
}
|
||||
|
||||
function testGetProperErrorForSubscriber() {
|
||||
public function testGetProperErrorForSubscriber() {
|
||||
$error = $this->mapper->getErrorForSubscriber('john@rambo.com');
|
||||
expect($error->getLevel())->equals(MailerError::LEVEL_HARD);
|
||||
expect($error->getMessage())->equals('PHPMail has returned an unknown error.');
|
||||
expect($error->getSubscriberErrors()[0]->getEmail())->equals('john@rambo.com');
|
||||
}
|
||||
|
||||
function testGetProperErrorFromException() {
|
||||
public function testGetProperErrorFromException() {
|
||||
$error = $this->mapper->getErrorFromException(new \Exception('Some message'), '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 testGetSoftErrorFromExceptionForInvalidEmail() {
|
||||
public function testGetSoftErrorFromExceptionForInvalidEmail() {
|
||||
$error = $this->mapper->getErrorFromException(new \Exception('Invalid address. (Add ...'), 'john@rambo.com');
|
||||
expect($error->getLevel())->equals(MailerError::LEVEL_SOFT);
|
||||
}
|
||||
|
||||
function _after() {
|
||||
public function _after() {
|
||||
WPFunctions::set(new WPFunctions);
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ class SMTPMapperTest extends \MailPoetUnitTest {
|
||||
/** @var SMTPMapper */
|
||||
private $mapper;
|
||||
|
||||
function _before() {
|
||||
public function _before() {
|
||||
parent::_before();
|
||||
$this->mapper = new SMTPMapper();
|
||||
WPFunctions::set(Stub::make(new WPFunctions, [
|
||||
@ -24,7 +24,7 @@ class SMTPMapperTest extends \MailPoetUnitTest {
|
||||
]));
|
||||
}
|
||||
|
||||
function testItCanProcessExceptionMessage() {
|
||||
public function testItCanProcessExceptionMessage() {
|
||||
$message = 'Connection could not be established with host localhost [Connection refused #111]' . PHP_EOL
|
||||
. 'Log data:' . PHP_EOL
|
||||
. '++ Starting Swift_SmtpTransport' . PHP_EOL
|
||||
@ -36,13 +36,13 @@ class SMTPMapperTest extends \MailPoetUnitTest {
|
||||
expect($error->getSubscriberErrors()[0]->getEmail())->equals('john@rambo.com');
|
||||
}
|
||||
|
||||
function testItCreatesSoftErrorForInvalidEmail() {
|
||||
public function testItCreatesSoftErrorForInvalidEmail() {
|
||||
$message = 'Invalid email';
|
||||
$error = $this->mapper->getErrorFromException(new Swift_RfcComplianceException($message), 'john@rambo.com');
|
||||
expect($error->getLevel())->equals(MailerError::LEVEL_SOFT);
|
||||
}
|
||||
|
||||
function testItCanProcessLogMessageWhenOneExists() {
|
||||
public function testItCanProcessLogMessageWhenOneExists() {
|
||||
$log = '++ Swift_SmtpTransport started' . PHP_EOL
|
||||
. '>> MAIL FROM:<moi@mrcasual.com>' . PHP_EOL
|
||||
. '<< 250 OK' . PHP_EOL
|
||||
@ -58,14 +58,14 @@ class SMTPMapperTest extends \MailPoetUnitTest {
|
||||
expect($error->getSubscriberErrors()[0]->getEmail('moi@mrcasual.com'));
|
||||
}
|
||||
|
||||
function testItReturnsGenericMessageWhenLogMessageDoesNotExist() {
|
||||
public function testItReturnsGenericMessageWhenLogMessageDoesNotExist() {
|
||||
$error = $this->mapper->getErrorFromLog(null, 'test@example.com');
|
||||
expect($error->getMessage())
|
||||
->equals(Mailer::METHOD_SMTP . ' has returned an unknown error.');
|
||||
expect($error->getSubscriberErrors()[0]->getEmail('moi@mrcasual.com'));
|
||||
}
|
||||
|
||||
function _after() {
|
||||
public function _after() {
|
||||
WPFunctions::set(new WPFunctions);
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ class SendGridMapperTest extends \MailPoetUnitTest {
|
||||
/** @var array */
|
||||
private $response = [];
|
||||
|
||||
function _before() {
|
||||
public function _before() {
|
||||
parent::_before();
|
||||
$this->mapper = new SendGridMapper();
|
||||
$this->response = [
|
||||
@ -23,14 +23,14 @@ class SendGridMapperTest extends \MailPoetUnitTest {
|
||||
];
|
||||
}
|
||||
|
||||
function testGetProperError() {
|
||||
public 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() {
|
||||
public function testGetSoftErrorForInvalidEmail() {
|
||||
$this->response['errors'][0] = 'Invalid email address ,,@';
|
||||
$error = $this->mapper->getErrorFromResponse($this->response, ',,@');
|
||||
expect($error->getLevel())->equals(MailerError::LEVEL_SOFT);
|
||||
|
Reference in New Issue
Block a user