Add public keyword to methods
[MAILPOET-2413]
This commit is contained in:
@@ -9,7 +9,7 @@ use MailPoet\Mailer\Methods\Common\BlacklistCheck;
|
||||
use MailPoet\Mailer\Methods\ErrorMappers\AmazonSESMapper;
|
||||
|
||||
class AmazonSESTest extends \MailPoetTest {
|
||||
function _before() {
|
||||
public function _before() {
|
||||
parent::_before();
|
||||
$this->settings = [
|
||||
'method' => 'AmazonSES',
|
||||
@@ -56,7 +56,7 @@ class AmazonSESTest extends \MailPoetTest {
|
||||
];
|
||||
}
|
||||
|
||||
function testItsConstructorWorks() {
|
||||
public function testItsConstructorWorks() {
|
||||
expect($this->mailer->aws_endpoint)
|
||||
->equals(
|
||||
sprintf('email.%s.amazonaws.com', $this->settings['region'])
|
||||
@@ -69,7 +69,7 @@ class AmazonSESTest extends \MailPoetTest {
|
||||
expect(preg_match('!^\d{8}$!', $this->mailer->date_without_time))->equals(1);
|
||||
}
|
||||
|
||||
function testWhenReturnPathIsNullItIsSetToSenderEmail() {
|
||||
public function testWhenReturnPathIsNullItIsSetToSenderEmail() {
|
||||
$mailer = new AmazonSES(
|
||||
$this->settings['region'],
|
||||
$this->settings['access_key'],
|
||||
@@ -82,7 +82,7 @@ class AmazonSESTest extends \MailPoetTest {
|
||||
expect($mailer->return_path)->equals($this->sender['from_email']);
|
||||
}
|
||||
|
||||
function testItChecksForValidRegion() {
|
||||
public function testItChecksForValidRegion() {
|
||||
try {
|
||||
$mailer = new AmazonSES(
|
||||
'random_region',
|
||||
@@ -99,7 +99,7 @@ class AmazonSESTest extends \MailPoetTest {
|
||||
}
|
||||
}
|
||||
|
||||
function testItCanGenerateBody() {
|
||||
public function testItCanGenerateBody() {
|
||||
$body = $this->mailer->getBody($this->newsletter, $this->subscriber);
|
||||
expect($body['Action'])->equals('SendRawEmail');
|
||||
expect($body['Version'])->equals('2010-12-01');
|
||||
@@ -108,7 +108,7 @@ class AmazonSESTest extends \MailPoetTest {
|
||||
->equals($this->mailer->encodeMessage($this->mailer->message));
|
||||
}
|
||||
|
||||
function testItCanCreateMessage() {
|
||||
public function testItCanCreateMessage() {
|
||||
$message = $this->mailer
|
||||
->createMessage($this->newsletter, $this->subscriber, $this->extra_params);
|
||||
expect($message->getTo())
|
||||
@@ -129,7 +129,7 @@ class AmazonSESTest extends \MailPoetTest {
|
||||
->equals('<' . $this->extra_params['unsubscribe_url'] . '>');
|
||||
}
|
||||
|
||||
function testItCanCreateRequest() {
|
||||
public function testItCanCreateRequest() {
|
||||
$request = $this->mailer->request($this->newsletter, $this->subscriber);
|
||||
// preserve the original message
|
||||
$raw_message = $this->mailer->encodeMessage($this->mailer->message);
|
||||
@@ -147,7 +147,7 @@ class AmazonSESTest extends \MailPoetTest {
|
||||
expect($request['body'])->equals(urldecode(http_build_query($body)));
|
||||
}
|
||||
|
||||
function testItCanCreateCanonicalRequest() {
|
||||
public function testItCanCreateCanonicalRequest() {
|
||||
$body = $this->mailer->getBody($this->newsletter, $this->subscriber);
|
||||
$canonicalRequest = explode(
|
||||
"\n",
|
||||
@@ -170,7 +170,7 @@ class AmazonSESTest extends \MailPoetTest {
|
||||
);
|
||||
}
|
||||
|
||||
function testItCanCreateCredentialScope() {
|
||||
public function testItCanCreateCredentialScope() {
|
||||
$credentialScope = $this->mailer->getCredentialScope();
|
||||
expect($credentialScope)
|
||||
->equals(
|
||||
@@ -181,7 +181,7 @@ class AmazonSESTest extends \MailPoetTest {
|
||||
);
|
||||
}
|
||||
|
||||
function testItCanCreateStringToSign() {
|
||||
public function testItCanCreateStringToSign() {
|
||||
$body = $this->mailer->getBody($this->newsletter, $this->subscriber);
|
||||
$credentialScope = $this->mailer->getCredentialScope();
|
||||
$canonicalRequest = $this->mailer->getCanonicalRequest($body);
|
||||
@@ -201,7 +201,7 @@ class AmazonSESTest extends \MailPoetTest {
|
||||
);
|
||||
}
|
||||
|
||||
function testItCanSignRequest() {
|
||||
public function testItCanSignRequest() {
|
||||
$body = $this->mailer->getBody($this->newsletter, $this->subscriber);
|
||||
$signedRequest = $this->mailer->signRequest($body);
|
||||
expect($signedRequest)
|
||||
@@ -215,7 +215,7 @@ class AmazonSESTest extends \MailPoetTest {
|
||||
->equals(1);
|
||||
}
|
||||
|
||||
function testItCannotSendWithoutProperAccessKey() {
|
||||
public function testItCannotSendWithoutProperAccessKey() {
|
||||
if (getenv('WP_TEST_MAILER_ENABLE_SENDING') !== 'true') $this->markTestSkipped();
|
||||
$this->mailer->aws_access_key = 'somekey';
|
||||
$result = $this->mailer->send(
|
||||
@@ -225,7 +225,7 @@ class AmazonSESTest extends \MailPoetTest {
|
||||
expect($result['response'])->false();
|
||||
}
|
||||
|
||||
function testItCatchesSendingErrors() {
|
||||
public function testItCatchesSendingErrors() {
|
||||
$invalid_subscriber = 'john.@doe.com';
|
||||
$result = $this->mailer->send(
|
||||
$this->newsletter,
|
||||
@@ -236,7 +236,7 @@ class AmazonSESTest extends \MailPoetTest {
|
||||
expect($result['error']->getMessage())->contains('does not comply with RFC 2822');
|
||||
}
|
||||
|
||||
function testItChecksBlacklistBeforeSending() {
|
||||
public function testItChecksBlacklistBeforeSending() {
|
||||
$blacklisted_subscriber = 'blacklist_test@example.com';
|
||||
$blacklist = Stub::make(new BlacklistCheck(), ['isBlacklisted' => true], $this);
|
||||
$mailer = Stub::make(
|
||||
@@ -253,7 +253,7 @@ class AmazonSESTest extends \MailPoetTest {
|
||||
expect($result['error']->getMessage())->contains('AmazonSES has returned an unknown error.');
|
||||
}
|
||||
|
||||
function testItCanSend() {
|
||||
public function testItCanSend() {
|
||||
if (getenv('WP_TEST_MAILER_ENABLE_SENDING') !== 'true') $this->markTestSkipped();
|
||||
$result = $this->mailer->send(
|
||||
$this->newsletter,
|
||||
|
@@ -13,7 +13,7 @@ use MailPoet\Services\AuthorizedEmailsController;
|
||||
use MailPoet\Services\Bridge\API;
|
||||
|
||||
class MailPoetAPITest extends \MailPoetTest {
|
||||
function _before() {
|
||||
public function _before() {
|
||||
parent::_before();
|
||||
$this->settings = [
|
||||
'method' => 'MailPoet',
|
||||
@@ -53,7 +53,7 @@ class MailPoetAPITest extends \MailPoetTest {
|
||||
];
|
||||
}
|
||||
|
||||
function testItCanGenerateBodyForSingleMessage() {
|
||||
public function testItCanGenerateBodyForSingleMessage() {
|
||||
$body = $this->mailer->getBody($this->newsletter, $this->subscriber);
|
||||
$subscriber = $this->mailer->processSubscriber($this->subscriber);
|
||||
expect($body[0]['to']['address'])->equals($subscriber['email']);
|
||||
@@ -67,7 +67,7 @@ class MailPoetAPITest extends \MailPoetTest {
|
||||
expect($body[0]['text'])->equals($this->newsletter['body']['text']);
|
||||
}
|
||||
|
||||
function testItCanGenerateBodyForMultipleMessages() {
|
||||
public function testItCanGenerateBodyForMultipleMessages() {
|
||||
$newsletters = array_fill(0, 10, $this->newsletter);
|
||||
$subscribers = array_fill(0, 10, $this->subscriber);
|
||||
$body = $this->mailer->getBody($newsletters, $subscribers);
|
||||
@@ -84,7 +84,7 @@ class MailPoetAPITest extends \MailPoetTest {
|
||||
expect($body[0]['text'])->equals($this->newsletter['body']['text']);
|
||||
}
|
||||
|
||||
function testItCanAddExtraParametersToSingleMessage() {
|
||||
public function testItCanAddExtraParametersToSingleMessage() {
|
||||
$extra_params = [
|
||||
'unsubscribe_url' => 'http://example.com',
|
||||
'meta' => $this->metaInfo,
|
||||
@@ -94,7 +94,7 @@ class MailPoetAPITest extends \MailPoetTest {
|
||||
expect($body[0]['meta'])->equals($extra_params['meta']);
|
||||
}
|
||||
|
||||
function testItCanAddExtraParametersToMultipleMessages() {
|
||||
public function testItCanAddExtraParametersToMultipleMessages() {
|
||||
$newsletters = array_fill(0, 10, $this->newsletter);
|
||||
$subscribers = array_fill(0, 10, $this->subscriber);
|
||||
$extra_params = [
|
||||
@@ -110,7 +110,7 @@ class MailPoetAPITest extends \MailPoetTest {
|
||||
expect($body[9]['meta'])->equals($extra_params['meta'][9]);
|
||||
}
|
||||
|
||||
function testItCanProcessSubscriber() {
|
||||
public function testItCanProcessSubscriber() {
|
||||
expect($this->mailer->processSubscriber('test@test.com'))
|
||||
->equals(
|
||||
[
|
||||
@@ -131,7 +131,7 @@ class MailPoetAPITest extends \MailPoetTest {
|
||||
]);
|
||||
}
|
||||
|
||||
function testItWillNotSendIfApiKeyIsMarkedInvalid() {
|
||||
public function testItWillNotSendIfApiKeyIsMarkedInvalid() {
|
||||
if (getenv('WP_TEST_MAILER_ENABLE_SENDING') !== 'true') $this->markTestSkipped();
|
||||
$this->mailer->api_key = 'someapi';
|
||||
$this->mailer->services_checker = Stub::make(
|
||||
@@ -146,7 +146,7 @@ class MailPoetAPITest extends \MailPoetTest {
|
||||
expect($result['response'])->false();
|
||||
}
|
||||
|
||||
function testItCannotSendWithoutProperApiKey() {
|
||||
public function testItCannotSendWithoutProperApiKey() {
|
||||
if (getenv('WP_TEST_MAILER_ENABLE_SENDING') !== 'true') $this->markTestSkipped();
|
||||
$this->mailer->api->setKey('someapi');
|
||||
$result = $this->mailer->send(
|
||||
@@ -156,7 +156,7 @@ class MailPoetAPITest extends \MailPoetTest {
|
||||
expect($result['response'])->false();
|
||||
}
|
||||
|
||||
function testItCanSend() {
|
||||
public function testItCanSend() {
|
||||
if (getenv('WP_TEST_MAILER_ENABLE_SENDING') !== 'true') $this->markTestSkipped();
|
||||
$result = $this->mailer->send(
|
||||
$this->newsletter,
|
||||
@@ -165,7 +165,7 @@ class MailPoetAPITest extends \MailPoetTest {
|
||||
expect($result['response'])->true();
|
||||
}
|
||||
|
||||
function testFormatConnectionError() {
|
||||
public function testFormatConnectionError() {
|
||||
$this->mailer->api = Stub::makeEmpty(
|
||||
'MailPoet\Services\Bridge\API',
|
||||
['sendMessages' => [
|
||||
@@ -180,7 +180,7 @@ class MailPoetAPITest extends \MailPoetTest {
|
||||
expect($result['error']->getOperation())->equals(MailerError::OPERATION_CONNECT);
|
||||
}
|
||||
|
||||
function testFormatErrorNotArray() {
|
||||
public function testFormatErrorNotArray() {
|
||||
$this->mailer->api = Stub::makeEmpty(
|
||||
'MailPoet\Services\Bridge\API',
|
||||
['sendMessages' => [
|
||||
@@ -196,7 +196,7 @@ class MailPoetAPITest extends \MailPoetTest {
|
||||
expect($result['error']->getOperation())->equals(MailerError::OPERATION_SEND);
|
||||
}
|
||||
|
||||
function testFormatErrorTooBig() {
|
||||
public function testFormatErrorTooBig() {
|
||||
$this->mailer->api = Stub::makeEmpty(
|
||||
'MailPoet\Services\Bridge\API',
|
||||
['sendMessages' => [
|
||||
@@ -211,7 +211,7 @@ class MailPoetAPITest extends \MailPoetTest {
|
||||
expect($result['error'])->isInstanceOf(MailerError::class);
|
||||
}
|
||||
|
||||
function testFormatPayloadError() {
|
||||
public function testFormatPayloadError() {
|
||||
$this->mailer->api = Stub::makeEmpty(
|
||||
'MailPoet\Services\Bridge\API',
|
||||
['sendMessages' => [
|
||||
@@ -227,7 +227,7 @@ class MailPoetAPITest extends \MailPoetTest {
|
||||
expect($result['error']->getOperation())->equals(MailerError::OPERATION_SEND);
|
||||
}
|
||||
|
||||
function testFormatPayloadErrorWithErrorMessage() {
|
||||
public function testFormatPayloadErrorWithErrorMessage() {
|
||||
$this->mailer->api = Stub::makeEmpty(
|
||||
'MailPoet\Services\Bridge\API',
|
||||
['sendMessages' => [
|
||||
@@ -243,7 +243,7 @@ class MailPoetAPITest extends \MailPoetTest {
|
||||
expect($result['error']->getOperation())->equals(MailerError::OPERATION_SEND);
|
||||
}
|
||||
|
||||
function testItCallsAuthorizedEmailsValidationOnRelatedError() {
|
||||
public function testItCallsAuthorizedEmailsValidationOnRelatedError() {
|
||||
$mailer = new MailPoet(
|
||||
$this->settings['api_key'],
|
||||
$this->sender,
|
||||
@@ -263,7 +263,7 @@ class MailPoetAPITest extends \MailPoetTest {
|
||||
$mailer->send([$this->newsletter], [$this->subscriber]);
|
||||
}
|
||||
|
||||
function testItChecksBlacklistBeforeSendingToASingleSubscriber() {
|
||||
public function testItChecksBlacklistBeforeSendingToASingleSubscriber() {
|
||||
$blacklisted_subscriber = 'blacklist_test@example.com';
|
||||
$blacklist = Stub::make(new BlacklistCheck(), ['isBlacklisted' => true], $this);
|
||||
$mailer = Stub::make(
|
||||
@@ -289,7 +289,7 @@ class MailPoetAPITest extends \MailPoetTest {
|
||||
expect($result['error']->getMessage())->contains('MailPoet has returned an unknown error.');
|
||||
}
|
||||
|
||||
function testItChecksBlacklistBeforeSendingToMultipleSubscribers() {
|
||||
public function testItChecksBlacklistBeforeSendingToMultipleSubscribers() {
|
||||
$blacklisted_subscriber = 'blacklist_test@example.com';
|
||||
$blacklist = Stub::make(new BlacklistCheck(), ['isBlacklisted' => true], $this);
|
||||
$mailer = Stub::make(
|
||||
|
@@ -9,7 +9,7 @@ use MailPoet\Mailer\Methods\ErrorMappers\PHPMailMapper;
|
||||
use MailPoet\Mailer\Methods\PHPMail;
|
||||
|
||||
class PHPMailTest extends \MailPoetTest {
|
||||
function _before() {
|
||||
public function _before() {
|
||||
parent::_before();
|
||||
$this->sender = [
|
||||
'from_name' => 'Sender',
|
||||
@@ -41,13 +41,13 @@ class PHPMailTest extends \MailPoetTest {
|
||||
];
|
||||
}
|
||||
|
||||
function testItCanBuildMailer() {
|
||||
public function testItCanBuildMailer() {
|
||||
$mailer = $this->mailer->buildMailer();
|
||||
expect($mailer)->isInstanceOf('PHPMailer');
|
||||
expect($mailer->Mailer)->equals('mail'); // uses PHP's mail() function
|
||||
}
|
||||
|
||||
function testWhenReturnPathIsNullItIsSetToSenderEmail() {
|
||||
public function testWhenReturnPathIsNullItIsSetToSenderEmail() {
|
||||
$mailer = new PHPMail(
|
||||
$this->sender,
|
||||
$this->reply_to,
|
||||
@@ -57,7 +57,7 @@ class PHPMailTest extends \MailPoetTest {
|
||||
expect($mailer->return_path)->equals($this->sender['from_email']);
|
||||
}
|
||||
|
||||
function testItCanConfigureMailerWithMessage() {
|
||||
public function testItCanConfigureMailerWithMessage() {
|
||||
$mailer = $this->mailer
|
||||
->configureMailerWithMessage($this->newsletter, $this->subscriber, $this->extra_params);
|
||||
expect($mailer->CharSet)->equals('UTF-8');
|
||||
@@ -98,7 +98,7 @@ class PHPMailTest extends \MailPoetTest {
|
||||
);
|
||||
}
|
||||
|
||||
function testItCanConfigureMailerWithTextEmail() {
|
||||
public function testItCanConfigureMailerWithTextEmail() {
|
||||
$mailer = $this->mailer
|
||||
->configureMailerWithMessage([
|
||||
'subject' => 'testing local method (PHP mail)',
|
||||
@@ -110,7 +110,7 @@ class PHPMailTest extends \MailPoetTest {
|
||||
expect($mailer->Body)->equals('TEXT body');
|
||||
}
|
||||
|
||||
function testItCanProcessSubscriber() {
|
||||
public function testItCanProcessSubscriber() {
|
||||
expect($this->mailer->processSubscriber('test@test.com'))->equals(
|
||||
[
|
||||
'email' => 'test@test.com',
|
||||
@@ -128,7 +128,7 @@ class PHPMailTest extends \MailPoetTest {
|
||||
]);
|
||||
}
|
||||
|
||||
function testItChecksBlacklistBeforeSending() {
|
||||
public function testItChecksBlacklistBeforeSending() {
|
||||
$blacklisted_subscriber = 'blacklist_test@example.com';
|
||||
$blacklist = Stub::make(new BlacklistCheck(), ['isBlacklisted' => true], $this);
|
||||
$mailer = Stub::make(
|
||||
@@ -145,7 +145,7 @@ class PHPMailTest extends \MailPoetTest {
|
||||
expect($result['error']->getMessage())->contains('PHPMail has returned an unknown error.');
|
||||
}
|
||||
|
||||
function testItCanSend() {
|
||||
public function testItCanSend() {
|
||||
if (getenv('WP_TEST_MAILER_ENABLE_SENDING') !== 'true') $this->markTestSkipped();
|
||||
$result = $this->mailer->send(
|
||||
$this->newsletter,
|
||||
|
@@ -10,7 +10,7 @@ use MailPoet\Mailer\Methods\SMTP;
|
||||
use MailPoet\WP\Functions as WPFunctions;
|
||||
|
||||
class SMTPTest extends \MailPoetTest {
|
||||
function _before() {
|
||||
public function _before() {
|
||||
parent::_before();
|
||||
$this->settings = [
|
||||
'method' => 'SMTP',
|
||||
@@ -63,7 +63,7 @@ class SMTPTest extends \MailPoetTest {
|
||||
];
|
||||
}
|
||||
|
||||
function testItCanBuildMailer() {
|
||||
public function testItCanBuildMailer() {
|
||||
$mailer = $this->mailer->buildMailer();
|
||||
expect($mailer->getTransport()->getHost())
|
||||
->equals($this->settings['host']);
|
||||
@@ -77,7 +77,7 @@ class SMTPTest extends \MailPoetTest {
|
||||
->equals($this->settings['encryption']);
|
||||
}
|
||||
|
||||
function testWhenReturnPathIsNullItIsSetToSenderEmail() {
|
||||
public function testWhenReturnPathIsNullItIsSetToSenderEmail() {
|
||||
$mailer = new SMTP(
|
||||
$this->settings['host'],
|
||||
$this->settings['port'],
|
||||
@@ -93,7 +93,7 @@ class SMTPTest extends \MailPoetTest {
|
||||
expect($mailer->return_path)->equals($this->sender['from_email']);
|
||||
}
|
||||
|
||||
function testItCanCreateMessage() {
|
||||
public function testItCanCreateMessage() {
|
||||
$message = $this->mailer
|
||||
->createMessage($this->newsletter, $this->subscriber, $this->extra_params);
|
||||
expect($message->getTo())
|
||||
@@ -114,7 +114,7 @@ class SMTPTest extends \MailPoetTest {
|
||||
->equals('<' . $this->extra_params['unsubscribe_url'] . '>');
|
||||
}
|
||||
|
||||
function testItCanProcessSubscriber() {
|
||||
public function testItCanProcessSubscriber() {
|
||||
expect($this->mailer->processSubscriber('test@test.com'))
|
||||
->equals(['test@test.com' => '']);
|
||||
expect($this->mailer->processSubscriber('First <test@test.com>'))
|
||||
@@ -123,7 +123,7 @@ class SMTPTest extends \MailPoetTest {
|
||||
->equals(['test@test.com' => 'First Last']);
|
||||
}
|
||||
|
||||
function testItCantSendWithoutProperAuthentication() {
|
||||
public function testItCantSendWithoutProperAuthentication() {
|
||||
if (getenv('WP_TEST_MAILER_ENABLE_SENDING') !== 'true') $this->markTestSkipped();
|
||||
$this->mailer->login = 'someone';
|
||||
$this->mailer->mailer = $this->mailer->buildMailer();
|
||||
@@ -134,7 +134,7 @@ class SMTPTest extends \MailPoetTest {
|
||||
expect($result['response'])->false();
|
||||
}
|
||||
|
||||
function testItAppliesTransportFilter() {
|
||||
public function testItAppliesTransportFilter() {
|
||||
$mailer = $this->mailer->buildMailer();
|
||||
expect($mailer->getTransport()->getStreamOptions())->isEmpty();
|
||||
(new WPFunctions)->addFilter(
|
||||
@@ -162,7 +162,7 @@ class SMTPTest extends \MailPoetTest {
|
||||
);
|
||||
}
|
||||
|
||||
function testItAppliesTimeoutFilter() {
|
||||
public function testItAppliesTimeoutFilter() {
|
||||
$mailer = $this->mailer->buildMailer();
|
||||
expect($mailer->getTransport()->getTimeout())->equals(\MailPoet\Mailer\Methods\SMTP::SMTP_CONNECTION_TIMEOUT);
|
||||
(new WPFunctions)->addFilter(
|
||||
@@ -175,7 +175,7 @@ class SMTPTest extends \MailPoetTest {
|
||||
expect($mailer->getTransport()->getTimeout())->equals(20);
|
||||
}
|
||||
|
||||
function testItChecksBlacklistBeforeSending() {
|
||||
public function testItChecksBlacklistBeforeSending() {
|
||||
$blacklisted_subscriber = 'blacklist_test@example.com';
|
||||
$blacklist = Stub::make(new BlacklistCheck(), ['isBlacklisted' => true], $this);
|
||||
$mailer = Stub::make(
|
||||
@@ -192,7 +192,7 @@ class SMTPTest extends \MailPoetTest {
|
||||
expect($result['error']->getMessage())->contains('SMTP has returned an unknown error.');
|
||||
}
|
||||
|
||||
function testItCanSend() {
|
||||
public function testItCanSend() {
|
||||
if (getenv('WP_TEST_MAILER_ENABLE_SENDING') !== 'true') $this->markTestSkipped();
|
||||
$result = $this->mailer->send(
|
||||
$this->newsletter,
|
||||
@@ -201,6 +201,6 @@ class SMTPTest extends \MailPoetTest {
|
||||
expect($result['response'])->true();
|
||||
}
|
||||
|
||||
function _after() {
|
||||
public function _after() {
|
||||
}
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@ use MailPoet\Mailer\Methods\ErrorMappers\SendGridMapper;
|
||||
use MailPoet\Mailer\Methods\SendGrid;
|
||||
|
||||
class SendGridTest extends \MailPoetTest {
|
||||
function _before() {
|
||||
public function _before() {
|
||||
parent::_before();
|
||||
$this->settings = [
|
||||
'method' => 'SendGrid',
|
||||
@@ -46,7 +46,7 @@ class SendGridTest extends \MailPoetTest {
|
||||
];
|
||||
}
|
||||
|
||||
function testItCanGenerateBody() {
|
||||
public function testItCanGenerateBody() {
|
||||
$body = $this->mailer->getBody($this->newsletter, $this->subscriber, $this->extra_params);
|
||||
expect($body['to'])->contains($this->subscriber);
|
||||
expect($body['from'])->equals($this->sender['from_email']);
|
||||
@@ -60,7 +60,7 @@ class SendGridTest extends \MailPoetTest {
|
||||
expect($body['text'])->equals($this->newsletter['body']['text']);
|
||||
}
|
||||
|
||||
function testItCanCreateRequest() {
|
||||
public function testItCanCreateRequest() {
|
||||
$body = $this->mailer->getBody($this->newsletter, $this->subscriber);
|
||||
$request = $this->mailer->request($this->newsletter, $this->subscriber);
|
||||
expect($request['timeout'])->equals(10);
|
||||
@@ -71,12 +71,12 @@ class SendGridTest extends \MailPoetTest {
|
||||
expect($request['body'])->equals(http_build_query($body));
|
||||
}
|
||||
|
||||
function testItCanDoBasicAuth() {
|
||||
public function testItCanDoBasicAuth() {
|
||||
expect($this->mailer->auth())
|
||||
->equals('Bearer ' . $this->settings['api_key']);
|
||||
}
|
||||
|
||||
function testItCannotSendWithoutProperApiKey() {
|
||||
public function testItCannotSendWithoutProperApiKey() {
|
||||
if (getenv('WP_TEST_MAILER_ENABLE_SENDING') !== 'true') $this->markTestSkipped();
|
||||
$this->mailer->api_key = 'someapi';
|
||||
$result = $this->mailer->send(
|
||||
@@ -86,7 +86,7 @@ class SendGridTest extends \MailPoetTest {
|
||||
expect($result['response'])->false();
|
||||
}
|
||||
|
||||
function testItChecksBlacklistBeforeSending() {
|
||||
public function testItChecksBlacklistBeforeSending() {
|
||||
$blacklisted_subscriber = 'blacklist_test@example.com';
|
||||
$blacklist = Stub::make(new BlacklistCheck(), ['isBlacklisted' => true], $this);
|
||||
$mailer = Stub::make(
|
||||
@@ -103,7 +103,7 @@ class SendGridTest extends \MailPoetTest {
|
||||
expect($result['error']->getMessage())->contains('SendGrid has returned an unknown error.');
|
||||
}
|
||||
|
||||
function testItCanSend() {
|
||||
public function testItCanSend() {
|
||||
if (getenv('WP_TEST_MAILER_ENABLE_SENDING') !== 'true') $this->markTestSkipped();
|
||||
$result = $this->mailer->send(
|
||||
$this->newsletter,
|
||||
|
Reference in New Issue
Block a user