Skip to content

Commit

Permalink
MAGETWO-67680: Replace Zend_Mail (ZF1) with Zend\Mail (ZF2) #8608
Browse files Browse the repository at this point in the history
 - fixed integration tests
  • Loading branch information
Oleksii Korshenko committed Jul 7, 2017
1 parent 32f94ce commit 212632f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
14 changes: 7 additions & 7 deletions app/code/Magento/Directory/Model/Observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,14 @@ public function scheduledUpdateCurrencyRates($schedule)
}
}

$errorRecipient = $this->_scopeConfig->getValue(
self::XML_PATH_ERROR_RECIPIENT,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
if (sizeof($importWarnings) == 0) {
$this->_currencyFactory->create()->saveRates($rates);
} else {
} elseif ($errorRecipient) {
//if $errorRecipient is not set, there is no sense send email to nobody
$this->inlineTranslation->suspend();

$this->_transportBuilder->setTemplateIdentifier(
Expand All @@ -148,12 +153,7 @@ public function scheduledUpdateCurrencyRates($schedule)
self::XML_PATH_ERROR_IDENTITY,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
)
)->addTo(
$this->_scopeConfig->getValue(
self::XML_PATH_ERROR_RECIPIENT,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
)
);
)->addTo($errorRecipient);
$transport = $this->_transportBuilder->getTransport();
$transport->sendMessage();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,12 @@ public function setUp()

/**
* @param int $templateType
* @param string $messageType
* @param string $bodyText
* @return void
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function testGetTransport(
$templateType = TemplateTypesInterface::TYPE_HTML,
$messageType = MessageInterface::TYPE_HTML,
$bodyText = '<h1>Html message</h1>'
) {
$filter = $this->getMock(\Magento\Email\Model\Template\Filter::class, [], [], '', false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Magento\Framework\Mail\MessageInterface;
use Magento\Framework\Mail\TransportInterfaceFactory;
use Magento\Framework\ObjectManagerInterface;
use Magento\Framework\Phrase;

/**
* @api
Expand Down Expand Up @@ -279,9 +280,9 @@ protected function prepareMessage()
$this->message->setBodyHtml($body);
break;

default;
default:
throw new LocalizedException(
__('Unknown template type')
new Phrase('Unknown template type')
);
break;
}
Expand Down

0 comments on commit 212632f

Please sign in to comment.