Skip to content

Commit 00bc417

Browse files
committed
Fix integration test and code style issues
1 parent 0be511c commit 00bc417

File tree

4 files changed

+38
-6
lines changed

4 files changed

+38
-6
lines changed

dev/tests/integration/testsuite/Magento/Wishlist/Controller/IndexTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public function testSendAction()
158158
);
159159

160160
$actualResult = \Zend_Mime_Decode::decodeQuotedPrintable(
161-
$transportBuilder->getSentMessage()->getBodyHtml()->getContent()
161+
$transportBuilder->getSentMessage()->getRawMessage()
162162
);
163163

164164
$this->assertStringMatchesFormat(

lib/internal/Magento/Framework/Mail/Message.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,52 +64,85 @@ public function setBody($body)
6464
return $this;
6565
}
6666

67+
/**
68+
* @param string $subject
69+
* @return $this
70+
*/
6771
public function setSubject($subject)
6872
{
6973
$this->zendMessage->setSubject($subject);
7074
return $this;
7175
}
7276

77+
/**
78+
* @return null|string
79+
*/
7380
public function getSubject()
7481
{
7582
return $this->zendMessage->getSubject();
7683
}
7784

85+
/**
86+
* @return object
87+
*/
7888
public function getBody()
7989
{
8090
return $this->zendMessage->getBody();
8191
}
8292

93+
/**
94+
* @param array|string $fromAddress
95+
* @return $this
96+
*/
8397
public function setFrom($fromAddress)
8498
{
8599
$this->zendMessage->setFrom($fromAddress);
86100
return $this;
87101
}
88102

103+
/**
104+
* @param array|string $toAddress
105+
* @return $this
106+
*/
89107
public function addTo($toAddress)
90108
{
91109
$this->zendMessage->addTo($toAddress);
92110
return $this;
93111
}
94112

113+
/**
114+
* @param array|string $ccAddress
115+
* @return $this
116+
*/
95117
public function addCc($ccAddress)
96118
{
97119
$this->zendMessage->addCc($ccAddress);
98120
return $this;
99121
}
100122

123+
/**
124+
* @param array|string $bccAddress
125+
* @return $this
126+
*/
101127
public function addBcc($bccAddress)
102128
{
103129
$this->zendMessage->addBcc($bccAddress);
104130
return $this;
105131
}
106132

133+
/**
134+
* @param array|string $replyToAddress
135+
* @return $this
136+
*/
107137
public function setReplyTo($replyToAddress)
108138
{
109139
$this->zendMessage->setReplyTo($replyToAddress);
110140
return $this;
111141
}
112142

143+
/**
144+
* @return string
145+
*/
113146
public function getRawMessage()
114147
{
115148
return $this->zendMessage->toString();

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
use Magento\Framework\App\TemplateTypesInterface;
99
use Magento\Framework\Mail\MessageInterface;
10-
use Zend\Mail\Headers;
1110

1211
class TransportBuilderTest extends \PHPUnit_Framework_TestCase
1312
{
@@ -54,7 +53,6 @@ protected function setUp()
5453
$objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
5554
$this->templateFactoryMock = $this->getMock(\Magento\Framework\Mail\Template\FactoryInterface::class);
5655
$this->messageMock = $this->getMock(\Magento\Framework\Mail\Message::class);
57-
$this->messageMock->method('getHeaders')->willReturn(new Headers());
5856
$this->objectManagerMock = $this->getMock(\Magento\Framework\ObjectManagerInterface::class);
5957
$this->senderResolverMock = $this->getMock(\Magento\Framework\Mail\Template\SenderResolverInterface::class);
6058
$this->mailTransportFactoryMock = $this->getMockBuilder(

lib/internal/Magento/Framework/Mail/Transport.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ class Transport implements \Magento\Framework\Mail\TransportInterface
1212
* @var \Zend\Mail\Transport\Sendmail
1313
*/
1414
private $zendTransport;
15+
1516
/**
1617
* @var \Magento\Framework\Mail\MessageInterface
1718
*/
18-
protected $_message;
19+
private $message;
1920

2021
/**
2122
* @param MessageInterface $message
@@ -25,7 +26,7 @@ class Transport implements \Magento\Framework\Mail\TransportInterface
2526
public function __construct(\Magento\Framework\Mail\MessageInterface $message, $parameters = null)
2627
{
2728
$this->zendTransport = new \Zend\Mail\Transport\Sendmail($parameters);
28-
$this->_message = $message;
29+
$this->message = $message;
2930
}
3031

3132
/**
@@ -38,7 +39,7 @@ public function sendMessage()
3839
{
3940
try {
4041
$this->zendTransport->send(
41-
\Zend\Mail\Message::fromString($this->_message->getRawMessage())
42+
\Zend\Mail\Message::fromString($this->message->getRawMessage())
4243
);
4344
} catch (\Exception $e) {
4445
throw new \Magento\Framework\Exception\MailException(new \Magento\Framework\Phrase($e->getMessage()), $e);

0 commit comments

Comments
 (0)