MessageTest.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\Mail\Test\Unit;
  7. class MessageTest extends \PHPUnit\Framework\TestCase
  8. {
  9. /**
  10. * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Mail\Message
  11. */
  12. protected $_messageMock;
  13. protected function setUp()
  14. {
  15. $this->_messageMock = $this->createPartialMock(
  16. \Magento\Framework\Mail\Message::class,
  17. ['setBody', 'setMessageType']
  18. );
  19. }
  20. public function testSetBodyHtml()
  21. {
  22. $this->_messageMock->expects($this->once())
  23. ->method('setMessageType')
  24. ->with('text/html');
  25. $this->_messageMock->expects($this->once())
  26. ->method('setBody')
  27. ->with('body');
  28. $this->_messageMock->setBodyHtml('body');
  29. }
  30. public function testSetBodyText()
  31. {
  32. $this->_messageMock->expects($this->once())
  33. ->method('setMessageType')
  34. ->with('text/plain');
  35. $this->_messageMock->expects($this->once())
  36. ->method('setBody')
  37. ->with('body');
  38. $this->_messageMock->setBodyText('body');
  39. }
  40. }