|
8 | 8 | class MessageTest extends \PHPUnit_Framework_TestCase
|
9 | 9 | {
|
10 | 10 | /**
|
11 |
| - * @var \PHPUnit_Framework_MockObject |
| 11 | + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Mail\Message |
12 | 12 | */
|
13 | 13 | protected $_messageMock;
|
14 | 14 |
|
15 | 15 | protected function setUp()
|
16 | 16 | {
|
17 |
| - $this->markTestSkipped('obsolete ZF 1 test'); |
18 | 17 | $this->_messageMock = $this->getMock(
|
19 | 18 | \Magento\Framework\Mail\Message::class,
|
20 |
| - ['getBodyText', 'getBodyHtml', 'setBodyText', 'setBodyHtml'] |
| 19 | + ['setBody', 'setMessageType'] |
21 | 20 | );
|
22 | 21 | }
|
23 | 22 |
|
24 |
| - /** |
25 |
| - * @param string $messageType |
26 |
| - * @param string $method |
27 |
| - * |
28 |
| - * @covers \Magento\Framework\Mail\Message::setBody |
29 |
| - * @covers \Magento\Framework\Mail\Message::setMessageType |
30 |
| - * @dataProvider setBodyDataProvider |
31 |
| - */ |
32 |
| - public function testSetBody($messageType, $method) |
| 23 | + public function testSetBodyHtml() |
33 | 24 | {
|
34 |
| - $this->_messageMock->setMessageType($messageType); |
| 25 | + $this->_messageMock->expects($this->once()) |
| 26 | + ->method('setMessageType') |
| 27 | + ->with('text/html'); |
35 | 28 |
|
36 | 29 | $this->_messageMock->expects($this->once())
|
37 |
| - ->method($method) |
| 30 | + ->method('setBody') |
38 | 31 | ->with('body');
|
39 | 32 |
|
40 |
| - $this->_messageMock->setBody('body'); |
| 33 | + $this->_messageMock->setBodyHtml('body'); |
41 | 34 | }
|
42 | 35 |
|
43 |
| - /** |
44 |
| - * @return array |
45 |
| - */ |
46 |
| - public function setBodyDataProvider() |
| 36 | + public function testSetBodyText() |
47 | 37 | {
|
48 |
| - return [ |
49 |
| - [ |
50 |
| - 'messageType' => 'text/plain', |
51 |
| - 'method' => 'setBodyText', |
52 |
| - ], |
53 |
| - [ |
54 |
| - 'messageType' => 'text/html', |
55 |
| - 'method' => 'setBodyHtml' |
56 |
| - ] |
57 |
| - ]; |
58 |
| - } |
59 |
| - |
60 |
| - /** |
61 |
| - * @param string $messageType |
62 |
| - * @param string $method |
63 |
| - * |
64 |
| - * @covers \Magento\Framework\Mail\Message::getBody |
65 |
| - * @covers \Magento\Framework\Mail\Message::setMessageType |
66 |
| - * @dataProvider getBodyDataProvider |
67 |
| - */ |
68 |
| - public function testGetBody($messageType, $method) |
69 |
| - { |
70 |
| - $this->_messageMock->setMessageType($messageType); |
71 |
| - |
72 | 38 | $this->_messageMock->expects($this->once())
|
73 |
| - ->method($method); |
| 39 | + ->method('setMessageType') |
| 40 | + ->with('text/plain'); |
74 | 41 |
|
75 |
| - $this->_messageMock->getBody('body'); |
76 |
| - } |
| 42 | + $this->_messageMock->expects($this->once()) |
| 43 | + ->method('setBody') |
| 44 | + ->with('body'); |
77 | 45 |
|
78 |
| - /** |
79 |
| - * @return array |
80 |
| - */ |
81 |
| - public function getBodyDataProvider() |
82 |
| - { |
83 |
| - return [ |
84 |
| - [ |
85 |
| - 'messageType' => 'text/plain', |
86 |
| - 'method' => 'getBodyText', |
87 |
| - ], |
88 |
| - [ |
89 |
| - 'messageType' => 'text/html', |
90 |
| - 'method' => 'getBodyHtml' |
91 |
| - ] |
92 |
| - ]; |
| 46 | + $this->_messageMock->setBodyText('body'); |
93 | 47 | }
|
94 | 48 | }
|
0 commit comments