Skip to content

Commit 212632f

Browse files
author
Oleksii Korshenko
committed
MAGETWO-67680: Replace Zend_Mail (ZF1) with Zend\Mail (ZF2) #8608
- fixed integration tests
1 parent 32f94ce commit 212632f

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

app/code/Magento/Directory/Model/Observer.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,14 @@ public function scheduledUpdateCurrencyRates($schedule)
126126
}
127127
}
128128

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

134139
$this->_transportBuilder->setTemplateIdentifier(
@@ -148,12 +153,7 @@ public function scheduledUpdateCurrencyRates($schedule)
148153
self::XML_PATH_ERROR_IDENTITY,
149154
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
150155
)
151-
)->addTo(
152-
$this->_scopeConfig->getValue(
153-
self::XML_PATH_ERROR_RECIPIENT,
154-
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
155-
)
156-
);
156+
)->addTo($errorRecipient);
157157
$transport = $this->_transportBuilder->getTransport();
158158
$transport->sendMessage();
159159

app/code/Magento/Newsletter/Test/Unit/Model/Queue/TransportBuilderTest.php

-2
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,12 @@ public function setUp()
7474

7575
/**
7676
* @param int $templateType
77-
* @param string $messageType
7877
* @param string $bodyText
7978
* @return void
8079
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
8180
*/
8281
public function testGetTransport(
8382
$templateType = TemplateTypesInterface::TYPE_HTML,
84-
$messageType = MessageInterface::TYPE_HTML,
8583
$bodyText = '<h1>Html message</h1>'
8684
) {
8785
$filter = $this->getMock(\Magento\Email\Model\Template\Filter::class, [], [], '', false);

lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Magento\Framework\Mail\MessageInterface;
1414
use Magento\Framework\Mail\TransportInterfaceFactory;
1515
use Magento\Framework\ObjectManagerInterface;
16+
use Magento\Framework\Phrase;
1617

1718
/**
1819
* @api
@@ -279,9 +280,9 @@ protected function prepareMessage()
279280
$this->message->setBodyHtml($body);
280281
break;
281282

282-
default;
283+
default:
283284
throw new LocalizedException(
284-
__('Unknown template type')
285+
new Phrase('Unknown template type')
285286
);
286287
break;
287288
}

0 commit comments

Comments
 (0)