Separate checking and storing of the keys [MAILPOET-939]

This commit is contained in:
stoletniy
2017-06-15 13:00:56 +03:00
parent 181d7b9876
commit 1aba3112e9
8 changed files with 185 additions and 69 deletions

View File

@ -8,6 +8,7 @@ use MailPoet\Services\Bridge;
class SendingServiceKeyCheckTest extends MailPoetTest {
function _before() {
$this->mss_key = 'some_key';
$this->worker = new SendingServiceKeyCheck(microtime(true));
}
@ -23,10 +24,20 @@ class SendingServiceKeyCheckTest extends MailPoetTest {
new Bridge,
array(
'checkMSSKey' => $response,
'storeMSSKeyAndState' => null,
'updateSubscriberCount' => Stub::once()
),
$this
);
$this->worker->bridge->expects($this->once())
->method('checkMSSKey')
->with($this->equalTo($this->mss_key));
$this->worker->bridge->expects($this->once())
->method('storeMSSKeyAndState')
->with(
$this->equalTo($this->mss_key),
$this->equalTo($response)
);
$this->setMailPoetSendingMethod();
expect($this->worker->checkKey())->equals($response);
}
@ -36,7 +47,7 @@ class SendingServiceKeyCheckTest extends MailPoetTest {
Mailer::MAILER_CONFIG_SETTING_NAME,
array(
'method' => 'MailPoet',
'mailpoet_api_key' => 'some_key',
'mailpoet_api_key' => $this->mss_key,
)
);
}