Fix a source value for Premium key in the worker [MAILPOET-890]

This commit is contained in:
stoletniy
2017-05-25 15:43:02 +03:00
parent afa06342a5
commit fb940065ea
2 changed files with 6 additions and 2 deletions

View File

@ -14,7 +14,7 @@ class PremiumKeyCheck extends KeyCheckWorker {
} }
function checkKey() { function checkKey() {
$premium_key = Setting::getValue(Bridge::PREMIUM_KEY_STATE_SETTING_NAME); $premium_key = Setting::getValue(Bridge::PREMIUM_KEY_SETTING_NAME);
$result = $this->bridge->checkPremiumKey($premium_key); $result = $this->bridge->checkPremiumKey($premium_key);
return $result; return $result;
} }

View File

@ -7,6 +7,7 @@ use MailPoet\Services\Bridge;
class PremiumKeyCheckTest extends MailPoetTest { class PremiumKeyCheckTest extends MailPoetTest {
function _before() { function _before() {
$this->premium_key = '123457890abcdef';
$this->worker = new PremiumKeyCheck(microtime(true)); $this->worker = new PremiumKeyCheck(microtime(true));
} }
@ -23,6 +24,9 @@ class PremiumKeyCheckTest extends MailPoetTest {
array('checkPremiumKey' => $response), array('checkPremiumKey' => $response),
$this $this
); );
$this->worker->bridge->expects($this->once())
->method('checkPremiumKey')
->with($this->equalTo($this->premium_key));
$this->fillPremiumKey(); $this->fillPremiumKey();
expect($this->worker->checkKey())->equals($response); expect($this->worker->checkKey())->equals($response);
} }
@ -30,7 +34,7 @@ class PremiumKeyCheckTest extends MailPoetTest {
private function fillPremiumKey() { private function fillPremiumKey() {
Setting::setValue( Setting::setValue(
Bridge::PREMIUM_KEY_SETTING_NAME, Bridge::PREMIUM_KEY_SETTING_NAME,
'123457890abcdef' $this->premium_key
); );
} }