diff --git a/lib/internal/Magento/Framework/Mail/Template/TransportBuilderByStore.php b/lib/internal/Magento/Framework/Mail/Template/TransportBuilderByStore.php index 88ad4f105f4b7..105a497a14bdb 100644 --- a/lib/internal/Magento/Framework/Mail/Template/TransportBuilderByStore.php +++ b/lib/internal/Magento/Framework/Mail/Template/TransportBuilderByStore.php @@ -1,62 +1,62 @@ -message = $message; - $this->senderResolver = $senderResolver; - } - - /** - * Set mail from address by store. - * - * @param string|array $from - * @param string|int $store - * - * @return $this - */ - public function setFromByStore($from, $store) - { - $result = $this->senderResolver->resolve($from, $store); - $this->message->clearFrom(); - $this->message->setFrom($result['email'], $result['name']); - - return $this; - } +message = $message; + $this->senderResolver = $senderResolver; + } + + /** + * Set mail from address by store. + * + * @param string|array $from + * @param string|int $store + * + * @return $this + */ + public function setFromByStore($from, $store) + { + $result = $this->senderResolver->resolve($from, $store); + $this->message->clearFrom(); + $this->message->setFrom($result['email'], $result['name']); + + return $this; + } } \ No newline at end of file diff --git a/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderByStoreTest.php b/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderByStoreTest.php index d9f9a194165d6..cebf2a8b15b7f 100644 --- a/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderByStoreTest.php +++ b/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderByStoreTest.php @@ -1,67 +1,67 @@ -messageMock = $this->createMock(\Magento\Framework\Mail\Message::class); - $this->senderResolverMock = $this->createMock(\Magento\Framework\Mail\Template\SenderResolverInterface::class); - - $this->model = $objectManagerHelper->getObject( - TransportBuilderByStore::class, - [ - 'message' => $this->messageMock, - 'senderResolver' => $this->senderResolverMock, - ] - ); - } - - /** - * @return void - */ - public function testSetFromByStore() - { - $sender = ['email' => 'from@example.com', 'name' => 'name']; - $store = 1; - $this->senderResolverMock->expects($this->once()) - ->method('resolve') - ->with($sender, $store) - ->willReturn($sender); - $this->messageMock->expects($this->once()) - ->method('setFrom') - ->with('from@example.com', 'name') - ->willReturnSelf(); - $this->messageMock->expects($this->once()) - ->method('clearFrom') - ->willReturnSelf(); - - $this->model->setFromByStore($sender, $store); - } +messageMock = $this->createMock(\Magento\Framework\Mail\Message::class); + $this->senderResolverMock = $this->createMock(\Magento\Framework\Mail\Template\SenderResolverInterface::class); + + $this->model = $objectManagerHelper->getObject( + TransportBuilderByStore::class, + [ + 'message' => $this->messageMock, + 'senderResolver' => $this->senderResolverMock, + ] + ); + } + + /** + * @return void + */ + public function testSetFromByStore() + { + $sender = ['email' => 'from@example.com', 'name' => 'name']; + $store = 1; + $this->senderResolverMock->expects($this->once()) + ->method('resolve') + ->with($sender, $store) + ->willReturn($sender); + $this->messageMock->expects($this->once()) + ->method('setFrom') + ->with('from@example.com', 'name') + ->willReturnSelf(); + $this->messageMock->expects($this->once()) + ->method('clearFrom') + ->willReturnSelf(); + + $this->model->setFromByStore($sender, $store); + } } \ No newline at end of file