Skip to content

Commit

Permalink
Reverted changes made in MAGETWO-96712
Browse files Browse the repository at this point in the history
  • Loading branch information
Graham Wharton committed Jan 10, 2019
1 parent fb572d8 commit 59a4e57
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 44 deletions.
16 changes: 0 additions & 16 deletions lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,6 @@ class TransportBuilder
*/
protected $templateOptions;

/**
* Mail from address
*
* @var string|array
*/
private $from;

/**
* Mail Transport
*
Expand Down Expand Up @@ -280,7 +273,6 @@ protected function reset()
$this->templateIdentifier = null;
$this->templateVars = null;
$this->templateOptions = null;
$this->from = null;
return $this;
}

Expand Down Expand Up @@ -314,14 +306,6 @@ protected function prepareMessage()
->setBody($body)
->setSubject(html_entity_decode($template->getSubject(), ENT_QUOTES));

if ($this->from) {
$from = $this->_senderResolver->resolve(
$this->from,
$template->getDesignConfig()->getStore()
);
$this->message->setFrom($from['email'], $from['name']);
}

return $this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
namespace Magento\Framework\Mail\Test\Unit\Template;

use Magento\Framework\App\TemplateTypesInterface;
use Magento\Framework\DataObject;
use Magento\Framework\Mail\MessageInterface;

/**
Expand Down Expand Up @@ -100,37 +99,17 @@ protected function setUp()
*/
public function testGetTransport($templateType, $messageType, $bodyText, $templateNamespace)
{
$this->builder->setTemplateModel($templateNamespace);

$vars = ['reason' => 'Reason', 'customer' => 'Customer'];
$options = ['area' => 'frontend', 'store' => 1];
$from = 'email_from';
$sender = ['email' => 'from@example.com', 'name' => 'name'];

$this->builder->setTemplateModel($templateNamespace);
$this->builder->setFrom($from);

$template = $this->createPartialMock(
\Magento\Framework\Mail\TemplateInterface::class,
[
'setVars',
'isPlain',
'setOptions',
'getSubject',
'getType',
'processTemplate',
'getDesignConfig',
]
);
$template = $this->createMock(\Magento\Framework\Mail\TemplateInterface::class);
$template->expects($this->once())->method('setVars')->with($this->equalTo($vars))->willReturnSelf();
$template->expects($this->once())->method('setOptions')->with($this->equalTo($options))->willReturnSelf();
$template->expects($this->once())->method('getSubject')->willReturn('Email Subject');
$template->expects($this->once())->method('getType')->willReturn($templateType);
$template->expects($this->once())->method('processTemplate')->willReturn($bodyText);
$template->method('getDesignConfig')->willReturn(new DataObject($options));

$this->senderResolverMock->expects($this->once())
->method('resolve')
->with($from, 1)
->willReturn($sender);

$this->templateFactoryMock->expects($this->once())
->method('get')
Expand All @@ -149,9 +128,6 @@ public function testGetTransport($templateType, $messageType, $bodyText, $templa
->method('setBody')
->with($this->equalTo($bodyText))
->willReturnSelf();
$this->messageMock->method('setFrom')
->with($sender['email'], $sender['name'])
->willReturnSelf();

$transport = $this->createMock(\Magento\Framework\Mail\TransportInterface::class);

Expand Down Expand Up @@ -184,7 +160,7 @@ public function getTransportDataProvider()
]
];
}

/**
* @return void
*/
Expand Down

0 comments on commit 59a4e57

Please sign in to comment.