Reset currentRecords only when needed
And reloadCache after domain verification. [MAILPOET-5844]
This commit is contained in:
committed by
Aschepikov
parent
928c100839
commit
d65fdd7a6d
@@ -118,6 +118,7 @@ class AuthorizedSenderDomainController {
|
||||
}
|
||||
|
||||
// Reset cached value since a new domain was added
|
||||
$this->currentRecords = null;
|
||||
$this->reloadCache();
|
||||
|
||||
return $response;
|
||||
@@ -147,7 +148,6 @@ class AuthorizedSenderDomainController {
|
||||
throw new \InvalidArgumentException(self::AUTHORIZED_SENDER_DOMAIN_ERROR_NOT_CREATED);
|
||||
}
|
||||
|
||||
$this->reloadCache();
|
||||
$verifiedDomains = $this->getFullyVerifiedSenderDomains(true);
|
||||
$alreadyVerified = in_array($domain, $verifiedDomains);
|
||||
|
||||
@@ -163,6 +163,9 @@ class AuthorizedSenderDomainController {
|
||||
throw new \InvalidArgumentException($response['message']);
|
||||
}
|
||||
|
||||
$this->currentRecords = null;
|
||||
$this->reloadCache();
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -233,7 +236,6 @@ class AuthorizedSenderDomainController {
|
||||
}
|
||||
|
||||
private function reloadCache() {
|
||||
$this->currentRecords = null;
|
||||
$this->currentRawData = $this->bridge->getRawSenderDomainData();
|
||||
$this->wp->setTransient(self::SENDER_DOMAINS_KEY, $this->currentRawData, 60 * 60 * 24);
|
||||
}
|
||||
|
@@ -284,7 +284,7 @@ class AuthorizedSenderDomainControllerTest extends \MailPoetTest {
|
||||
];
|
||||
|
||||
$getSenderDomainsExpectation = Expected::once($domains);
|
||||
$getSenderDomainsRawDataExpectation = Expected::once($domainsRawData);
|
||||
$getSenderDomainsRawDataExpectation = Expected::exactly(2, $domainsRawData);
|
||||
$verifySenderDomainsExpectation = Expected::once($response);
|
||||
|
||||
$bridgeMock = $this->make(Bridge::class, [
|
||||
|
Reference in New Issue
Block a user