Skip to content

Commit 9d8048f

Browse files
Merge branch 'MDVA-275' into 2-0-8-backlog
2 parents 211fff1 + c4a4747 commit 9d8048f

File tree

13 files changed

+82
-6
lines changed

13 files changed

+82
-6
lines changed

app/code/Magento/Checkout/Helper/Data.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,8 @@ public function sendPaymentFailedEmail($checkout, $message, $checkoutType = 'one
304304
'items' => nl2br($items),
305305
'total' => $total,
306306
]
307+
)->setScopeId(
308+
$checkout->getStoreId()
307309
)->setFrom(
308310
$this->scopeConfig->getValue(
309311
'checkout/payment_failed/identity',

app/code/Magento/Checkout/Test/Unit/Helper/DataTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,16 @@ public function testSendPaymentFailedEmail()
166166
$this->returnSelf()
167167
);
168168

169+
$this->_transportBuilder->expects(
170+
$this->once()
171+
)->method(
172+
'setScopeId'
173+
)->with(
174+
8
175+
)->will(
176+
$this->returnSelf()
177+
);
178+
169179
$this->_transportBuilder->expects(
170180
$this->once()
171181
)->method(

app/code/Magento/Customer/Model/AccountManagement.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,7 @@ protected function sendEmailTemplate($customer, $template, $sender, $templatePar
920920
$transport = $this->transportBuilder->setTemplateIdentifier($templateId)
921921
->setTemplateOptions(['area' => Area::AREA_FRONTEND, 'store' => $storeId])
922922
->setTemplateVars($templateParams)
923+
->setScopeId($storeId)
923924
->setFrom($this->scopeConfig->getValue($sender, ScopeInterface::SCOPE_STORE, $storeId))
924925
->addTo($customer->getEmail(), $this->customerViewHelper->getCustomerName($customer))
925926
->getTransport();

app/code/Magento/Customer/Model/Customer.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,8 @@ protected function _sendEmailTemplate($template, $sender, $templateParams = [],
828828
['area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $storeId]
829829
)->setTemplateVars(
830830
$templateParams
831+
)->setScopeId(
832+
$storeId
831833
)->setFrom(
832834
$this->_scopeConfig->getValue($sender, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId)
833835
)->addTo(

app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,10 @@ public function testCreateAccountWithoutPassword()
650650
$this->transportBuilder->expects($this->once())
651651
->method('setTemplateVars')
652652
->willReturnSelf();
653+
$this->transportBuilder->expects($this->once())
654+
->method('setScopeId')
655+
->with($defaultStoreId)
656+
->willReturnSelf();
653657
$this->transportBuilder->expects($this->once())
654658
->method('setFrom')
655659
->with($sender)
@@ -799,6 +803,10 @@ function ($string) {
799803
$this->transportBuilder->expects($this->once())
800804
->method('setTemplateVars')
801805
->willReturnSelf();
806+
$this->transportBuilder->expects($this->once())
807+
->method('setScopeId')
808+
->with($defaultStoreId)
809+
->willReturnSelf();
802810
$this->transportBuilder->expects($this->once())
803811
->method('setFrom')
804812
->with($sender)
@@ -901,6 +909,10 @@ public function testSendPasswordReminderEmail()
901909
->method('setTemplateVars')
902910
->with(['customer' => $this->customerSecure, 'store' => $this->store])
903911
->willReturnSelf();
912+
$this->transportBuilder->expects($this->once())
913+
->method('setScopeId')
914+
->with($customerStoreId)
915+
->willReturnSelf();
904916
$this->transportBuilder->expects($this->once())
905917
->method('setFrom')
906918
->with($sender)
@@ -1031,6 +1043,10 @@ protected function prepareEmailSend($email, $templateIdentifier, $sender, $store
10311043
->method('setTemplateVars')
10321044
->with(['customer' => $this->customerSecure, 'store' => $this->store])
10331045
->willReturnSelf();
1046+
$this->transportBuilder->expects($this->any())
1047+
->method('setScopeId')
1048+
->with($storeId)
1049+
->willReturnSelf();
10341050
$this->transportBuilder->expects($this->any())
10351051
->method('setFrom')
10361052
->with($sender)

app/code/Magento/Customer/Test/Unit/Model/CustomerTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ public function testSendNewAccountEmailWithoutStoreId()
215215
'setTemplateIdentifier',
216216
'setTemplateOptions',
217217
'setTemplateVars',
218+
'setScopeId',
218219
'setFrom',
219220
'addTo',
220221
];

app/code/Magento/Newsletter/Model/Subscriber.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,7 @@ public function sendConfirmationRequestEmail()
654654

655655
$this->inlineTranslation->suspend();
656656

657+
$storeId = $this->_storeManager->getStore()->getId();
657658
$this->_transportBuilder->setTemplateIdentifier(
658659
$this->_scopeConfig->getValue(
659660
self::XML_PATH_CONFIRM_EMAIL_TEMPLATE,
@@ -662,10 +663,12 @@ public function sendConfirmationRequestEmail()
662663
)->setTemplateOptions(
663664
[
664665
'area' => \Magento\Framework\App\Area::AREA_FRONTEND,
665-
'store' => $this->_storeManager->getStore()->getId(),
666+
'store' => $storeId,
666667
]
667668
)->setTemplateVars(
668669
['subscriber' => $this, 'store' => $this->_storeManager->getStore()]
670+
)->setScopeId(
671+
$storeId
669672
)->setFrom(
670673
$this->_scopeConfig->getValue(
671674
self::XML_PATH_CONFIRM_EMAIL_IDENTITY,
@@ -707,6 +710,7 @@ public function sendConfirmationSuccessEmail()
707710

708711
$this->inlineTranslation->suspend();
709712

713+
$storeId = $this->_storeManager->getStore()->getId();
710714
$this->_transportBuilder->setTemplateIdentifier(
711715
$this->_scopeConfig->getValue(
712716
self::XML_PATH_SUCCESS_EMAIL_TEMPLATE,
@@ -715,10 +719,12 @@ public function sendConfirmationSuccessEmail()
715719
)->setTemplateOptions(
716720
[
717721
'area' => \Magento\Framework\App\Area::AREA_FRONTEND,
718-
'store' => $this->_storeManager->getStore()->getId(),
722+
'store' => $storeId,
719723
]
720724
)->setTemplateVars(
721725
['subscriber' => $this]
726+
)->setScopeId(
727+
$storeId
722728
)->setFrom(
723729
$this->_scopeConfig->getValue(
724730
self::XML_PATH_SUCCESS_EMAIL_IDENTITY,
@@ -759,6 +765,7 @@ public function sendUnsubscriptionEmail()
759765

760766
$this->inlineTranslation->suspend();
761767

768+
$storeId = $this->_storeManager->getStore()->getId();
762769
$this->_transportBuilder->setTemplateIdentifier(
763770
$this->_scopeConfig->getValue(
764771
self::XML_PATH_UNSUBSCRIBE_EMAIL_TEMPLATE,
@@ -767,10 +774,12 @@ public function sendUnsubscriptionEmail()
767774
)->setTemplateOptions(
768775
[
769776
'area' => \Magento\Framework\App\Area::AREA_FRONTEND,
770-
'store' => $this->_storeManager->getStore()->getId(),
777+
'store' => $storeId,
771778
]
772779
)->setTemplateVars(
773780
['subscriber' => $this]
781+
)->setScopeId(
782+
$storeId
774783
)->setFrom(
775784
$this->_scopeConfig->getValue(
776785
self::XML_PATH_UNSUBSCRIBE_EMAIL_IDENTITY,

app/code/Magento/ProductAlert/Model/Email.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,8 @@ public function send()
374374
'customerName' => $this->_customerHelper->getCustomerName($this->_customer),
375375
'alertGrid' => $alertGrid,
376376
]
377+
)->setScopeId(
378+
$storeId
377379
)->setFrom(
378380
$this->_scopeConfig->getValue(
379381
self::XML_PATH_EMAIL_IDENTITY,

app/code/Magento/Sales/Model/Order/Email/SenderBuilder.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ public function sendCopyTo()
9595
*/
9696
protected function configureEmailTemplate()
9797
{
98+
$this->transportBuilder->setScopeId($this->identityContainer->getStore()->getStoreId());
9899
$this->transportBuilder->setTemplateIdentifier($this->templateContainer->getTemplateId());
99100
$this->transportBuilder->setTemplateOptions($this->templateContainer->getTemplateOptions());
100101
$this->transportBuilder->setTemplateVars($this->templateContainer->getTemplateVars());

app/code/Magento/Sales/Test/Unit/Model/Order/Email/SenderBuilderTest.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ class SenderBuilderTest extends \PHPUnit_Framework_TestCase
2929
*/
3030
protected $transportBuilder;
3131

32+
/**
33+
* @var \PHPUnit_Framework_MockObject_MockObject
34+
*/
35+
protected $storeMock;
36+
3237
protected function setUp()
3338
{
3439
$templateId = 'test_template_id';
@@ -58,7 +63,7 @@ protected function setUp()
5863
[
5964
'getEmailIdentity', 'getCustomerEmail',
6065
'getCustomerName', 'getTemplateOptions', 'getEmailCopyTo',
61-
'getCopyMethod'
66+
'getCopyMethod', 'getStore'
6267
],
6368
[],
6469
'',
@@ -99,6 +104,9 @@ protected function setUp()
99104
$this->identityContainerMock->expects($this->once())
100105
->method('getEmailIdentity')
101106
->will($this->returnValue($emailIdentity));
107+
$this->identityContainerMock->expects($this->once())
108+
->method('getStore')
109+
->will($this->returnValue($this->storeMock));
102110
$this->transportBuilder->expects($this->once())
103111
->method('setFrom')
104112
->with($this->equalTo($emailIdentity));

0 commit comments

Comments
 (0)