Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
MessageTest.php
Go to the documentation of this file.
1 <?php
7 
8 class MessageTest extends \PHPUnit\Framework\TestCase
9 {
13  protected $_messageMock;
14 
15  protected function setUp()
16  {
17  $this->_messageMock = $this->createPartialMock(
18  \Magento\Framework\Mail\Message::class,
19  ['setBody', 'setMessageType']
20  );
21  }
22 
23  public function testSetBodyHtml()
24  {
25  $this->_messageMock->expects($this->once())
26  ->method('setMessageType')
27  ->with('text/html');
28 
29  $this->_messageMock->expects($this->once())
30  ->method('setBody')
31  ->with('body');
32 
33  $this->_messageMock->setBodyHtml('body');
34  }
35 
36  public function testSetBodyText()
37  {
38  $this->_messageMock->expects($this->once())
39  ->method('setMessageType')
40  ->with('text/plain');
41 
42  $this->_messageMock->expects($this->once())
43  ->method('setBody')
44  ->with('body');
45 
46  $this->_messageMock->setBodyText('body');
47  }
48 }