Skip to content

Commit 133e0b2

Browse files
authored
Merge pull request #3784 from magento-engcom/ENGCOM-3969-magento-magento2-20621-2.3.1-release
[EngCom] Public Pull Requests - 2.3.1-release
2 parents 1766f4c + e9650c4 commit 133e0b2

File tree

4 files changed

+20
-18
lines changed

4 files changed

+20
-18
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ protected function configureEmailTemplate()
106106
$this->transportBuilder->setTemplateIdentifier($this->templateContainer->getTemplateId());
107107
$this->transportBuilder->setTemplateOptions($this->templateContainer->getTemplateOptions());
108108
$this->transportBuilder->setTemplateVars($this->templateContainer->getTemplateVars());
109-
$this->transportBuilder->setFromByStore(
109+
$this->transportBuilder->setFromByScope(
110110
$this->identityContainer->getEmailIdentity(),
111111
$this->identityContainer->getStore()->getId()
112112
);

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ protected function setUp()
7676
'setTemplateIdentifier',
7777
'setTemplateOptions',
7878
'setTemplateVars',
79-
'setFromByStore',
79+
'setFromByScope',
8080
]
8181
);
8282

@@ -103,7 +103,7 @@ protected function setUp()
103103
->method('getEmailIdentity')
104104
->will($this->returnValue($emailIdentity));
105105
$this->transportBuilder->expects($this->once())
106-
->method('setFromByStore')
106+
->method('setFromByScope')
107107
->with($this->equalTo($emailIdentity), 1);
108108

109109
$this->identityContainerMock->expects($this->once())
@@ -146,7 +146,7 @@ public function testSend()
146146
->method('getId')
147147
->willReturn(1);
148148
$this->transportBuilder->expects($this->once())
149-
->method('setFromByStore')
149+
->method('setFromByScope')
150150
->with($identity, 1);
151151
$this->transportBuilder->expects($this->once())
152152
->method('addTo')
@@ -176,7 +176,7 @@ public function testSendCopyTo()
176176
->method('addTo')
177177
->with($this->equalTo('example@mail.com'));
178178
$this->transportBuilder->expects($this->once())
179-
->method('setFromByStore')
179+
->method('setFromByScope')
180180
->with($identity, 1);
181181
$this->identityContainerMock->expects($this->once())
182182
->method('getStore')

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

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -177,29 +177,30 @@ public function setReplyTo($email, $name = null)
177177
/**
178178
* Set mail from address
179179
*
180-
* @deprecated This function sets the from address for the first store only.
181-
* new function setFromByStore introduced to allow setting of from address
182-
* based on store.
183-
* @see setFromByStore()
180+
* @deprecated This function sets the from address but does not provide
181+
* a way of setting the correct from addresses based on the scope.
182+
* @see setFromByScope()
184183
*
185184
* @param string|array $from
186185
* @return $this
186+
* @throws \Magento\Framework\Exception\MailException
187187
*/
188188
public function setFrom($from)
189189
{
190-
return $this->setFromByStore($from, null);
190+
return $this->setFromByScope($from, null);
191191
}
192192

193193
/**
194-
* Set mail from address by store
194+
* Set mail from address by scopeId
195195
*
196196
* @param string|array $from
197-
* @param string|int $store
197+
* @param string|int $scopeId
198198
* @return $this
199+
* @throws \Magento\Framework\Exception\MailException
199200
*/
200-
public function setFromByStore($from, $store = null)
201+
public function setFromByScope($from, $scopeId = null)
201202
{
202-
$result = $this->_senderResolver->resolve($from, $store);
203+
$result = $this->_senderResolver->resolve($from, $scopeId);
203204
$this->message->setFromAddress($result['email'], $result['name']);
204205
return $this;
205206
}
@@ -256,6 +257,7 @@ public function setTemplateOptions($templateOptions)
256257
* Get mail transport
257258
*
258259
* @return \Magento\Framework\Mail\TransportInterface
260+
* @throws LocalizedException
259261
*/
260262
public function getTransport()
261263
{

lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,20 +167,20 @@ public function getTransportDataProvider()
167167
/**
168168
* @return void
169169
*/
170-
public function testSetFromByStore()
170+
public function testSetFromByScope()
171171
{
172172
$sender = ['email' => 'from@example.com', 'name' => 'name'];
173-
$store = 1;
173+
$scopeId = 1;
174174
$this->senderResolverMock->expects($this->once())
175175
->method('resolve')
176-
->with($sender, $store)
176+
->with($sender, $scopeId)
177177
->willReturn($sender);
178178
$this->messageMock->expects($this->once())
179179
->method('setFromAddress')
180180
->with($sender['email'], $sender['name'])
181181
->willReturnSelf();
182182

183-
$this->builder->setFromByStore($sender, $store);
183+
$this->builder->setFromByScope($sender, $scopeId);
184184
}
185185

186186
/**

0 commit comments

Comments
 (0)