Skip to content

Commit b9a0c5d

Browse files
authored
ENGCOM-3969: Fix referenced to "store", changing to "scope" in Framework/Mail components #20621
2 parents 371d67b + 9360424 commit b9a0c5d

File tree

4 files changed

+29
-15
lines changed

4 files changed

+29
-15
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: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,29 +177,43 @@ 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
187186
*/
188187
public function setFrom($from)
189188
{
190-
return $this->setFromByStore($from, null);
189+
return $this->setFromByScope($from, null);
191190
}
192191

193192
/**
194193
* Set mail from address by store
195194
*
195+
* @deprecated Use setFromByScope
196+
* @see setFromByScope()
197+
*
196198
* @param string|array $from
197199
* @param string|int $store
198200
* @return $this
199201
*/
200202
public function setFromByStore($from, $store = null)
201203
{
202-
$result = $this->_senderResolver->resolve($from, $store);
204+
return $this->setFromByScope($from, $store);
205+
}
206+
207+
/**
208+
* Set mail from address by scopeId
209+
*
210+
* @param string|array $from
211+
* @param string|int $scopeId
212+
* @return $this
213+
*/
214+
public function setFromByScope($from, $scopeId = null)
215+
{
216+
$result = $this->_senderResolver->resolve($from, $scopeId);
203217
$this->message->setFromAddress($result['email'], $result['name']);
204218
return $this;
205219
}

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)