5
5
*/
6
6
namespace Magento \Sales \Test \Unit \Model \Order \Email \Sender ;
7
7
8
+ use Magento \Framework \App \Config ;
9
+ use Magento \Framework \App \Config \ScopeConfigInterface ;
10
+ use Magento \Framework \Event \Manager ;
11
+ use Magento \Payment \Helper \Data ;
12
+ use Magento \Payment \Model \Info ;
13
+ use Magento \Sales \Model \Order ;
14
+ use Magento \Sales \Model \Order \Address ;
15
+ use Magento \Sales \Model \Order \Address \Renderer ;
16
+ use Magento \Sales \Model \Order \Email \Container \Template ;
17
+ use Magento \Sales \Model \Order \Email \Sender ;
18
+ use Magento \Sales \Model \Order \Email \SenderBuilderFactory ;
19
+ use Magento \Store \Model \Store ;
20
+ use PHPUnit \Framework \MockObject \Matcher \InvokedCount ;
21
+ use PHPUnit \Framework \MockObject \MockObject ;
22
+ use Psr \Log \LoggerInterface ;
23
+
8
24
/**
9
25
* Class AbstractSenderTest
10
26
*
13
29
abstract class AbstractSenderTest extends \PHPUnit \Framework \TestCase
14
30
{
15
31
/**
16
- * @var \Magento\Sales\Model\Order\Email\ Sender|\PHPUnit_Framework_MockObject_MockObject
32
+ * @var Sender|MockObject
17
33
*/
18
34
protected $ senderMock ;
19
35
20
36
/**
21
- * @var \PHPUnit_Framework_MockObject_MockObject
37
+ * @var MockObject
22
38
*/
23
39
protected $ senderBuilderFactoryMock ;
24
40
25
41
/**
26
- * @var \PHPUnit_Framework_MockObject_MockObject
42
+ * @var MockObject
27
43
*/
28
44
protected $ templateContainerMock ;
29
45
30
46
/**
31
- * @var \PHPUnit_Framework_MockObject_MockObject
47
+ * @var MockObject
32
48
*/
33
49
protected $ identityContainerMock ;
34
50
35
51
/**
36
- * @var \PHPUnit_Framework_MockObject_MockObject
52
+ * @var MockObject
37
53
*/
38
54
protected $ storeMock ;
39
55
40
56
/**
41
- * @var \PHPUnit_Framework_MockObject_MockObject
57
+ * @var MockObject
42
58
*/
43
59
protected $ orderMock ;
44
60
45
61
/**
46
- * @var \PHPUnit_Framework_MockObject_MockObject
62
+ * @var MockObject
47
63
*/
48
64
protected $ paymentHelper ;
49
65
50
66
/**
51
- * @var \Magento\Sales\Model\Order\Address\ Renderer|\PHPUnit_Framework_MockObject_MockObject
67
+ * @var Renderer|MockObject
52
68
*/
53
69
protected $ addressRenderer ;
54
70
55
71
/**
56
72
* Global configuration storage mock.
57
73
*
58
- * @var \Magento\Framework\App\Config\ ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject
74
+ * @var ScopeConfigInterface|MockObject
59
75
*/
60
76
protected $ globalConfig ;
61
77
62
78
/**
63
- * @var \Magento\Sales\Model\Order\ Address|\PHPUnit_Framework_MockObject_MockObject
79
+ * @var Address|MockObject
64
80
*/
65
81
protected $ addressMock ;
66
82
67
83
/**
68
- * @var \Magento\Framework\Event\ Manager | \PHPUnit_Framework_MockObject_MockObject
84
+ * @var Manager|MockObject
69
85
*/
70
86
protected $ eventManagerMock ;
71
87
72
88
/**
73
- * @var \PHPUnit_Framework_MockObject_MockObject
89
+ * @var MockObject
74
90
*/
75
91
protected $ loggerMock ;
76
92
77
93
public function stepMockSetup ()
78
94
{
79
95
$ this ->senderMock = $ this ->createPartialMock (
80
- \ Magento \ Sales \ Model \ Order \ Email \ Sender::class,
96
+ Sender::class,
81
97
['send ' , 'sendCopyTo ' ]
82
98
);
83
99
84
100
$ this ->senderBuilderFactoryMock = $ this ->createPartialMock (
85
- \ Magento \ Sales \ Model \ Order \ Email \ SenderBuilderFactory::class,
101
+ SenderBuilderFactory::class,
86
102
['create ' ]
87
103
);
88
104
$ this ->templateContainerMock = $ this ->createPartialMock (
89
- \ Magento \ Sales \ Model \ Order \ Email \ Container \ Template::class,
105
+ Template::class,
90
106
['setTemplateVars ' ]
91
107
);
92
108
93
- $ this ->storeMock = $ this ->createPartialMock (\ Magento \ Store \ Model \ Store::class, ['getStoreId ' , '__wakeup ' ]);
109
+ $ this ->storeMock = $ this ->createPartialMock (Store::class, ['getStoreId ' , '__wakeup ' ]);
94
110
95
111
$ this ->orderMock = $ this ->createPartialMock (
96
- \ Magento \ Sales \ Model \ Order::class,
112
+ Order::class,
97
113
[
98
114
'getId ' , 'getStore ' , 'getBillingAddress ' , 'getPayment ' ,
99
115
'__wakeup ' , 'getCustomerIsGuest ' , 'getCustomerName ' ,
@@ -105,23 +121,23 @@ public function stepMockSetup()
105
121
$ this ->orderMock ->expects ($ this ->any ())
106
122
->method ('getStore ' )
107
123
->will ($ this ->returnValue ($ this ->storeMock ));
108
- $ paymentInfoMock = $ this ->createMock (\ Magento \ Payment \ Model \ Info::class);
124
+ $ paymentInfoMock = $ this ->createMock (Info::class);
109
125
$ this ->orderMock ->expects ($ this ->any ())
110
126
->method ('getPayment ' )
111
127
->will ($ this ->returnValue ($ paymentInfoMock ));
112
128
113
- $ this ->addressRenderer = $ this ->createMock (\ Magento \ Sales \ Model \ Order \ Address \ Renderer::class);
114
- $ this ->addressMock = $ this ->createMock (\ Magento \ Sales \ Model \ Order \ Address::class);
115
- $ this ->eventManagerMock = $ this ->createMock (\ Magento \ Framework \ Event \ Manager::class);
129
+ $ this ->addressRenderer = $ this ->createMock (Renderer::class);
130
+ $ this ->addressMock = $ this ->createMock (Address::class);
131
+ $ this ->eventManagerMock = $ this ->createMock (Manager::class);
116
132
117
- $ this ->paymentHelper = $ this ->createPartialMock (\ Magento \ Payment \ Helper \ Data::class, ['getInfoBlockHtml ' ]);
133
+ $ this ->paymentHelper = $ this ->createPartialMock (Data::class, ['getInfoBlockHtml ' ]);
118
134
$ this ->paymentHelper ->expects ($ this ->any ())
119
135
->method ('getInfoBlockHtml ' )
120
136
->will ($ this ->returnValue ('payment ' ));
121
137
122
- $ this ->globalConfig = $ this ->createPartialMock (\ Magento \ Framework \ App \ Config::class, ['getValue ' ]);
138
+ $ this ->globalConfig = $ this ->createPartialMock (Config::class, ['getValue ' ]);
123
139
124
- $ this ->loggerMock = $ this ->createMock (\ Psr \ Log \ LoggerInterface::class);
140
+ $ this ->loggerMock = $ this ->createMock (LoggerInterface::class);
125
141
}
126
142
127
143
/**
@@ -168,14 +184,14 @@ public function stepIdentityContainerInit($identityMockClassName)
168
184
}
169
185
170
186
/**
171
- * @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $sendExpects
172
- * @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $sendCopyToExpects
187
+ * @param InvokedCount $sendExpects
188
+ * @param InvokedCount $sendCopyToExpects
173
189
*/
174
190
protected function stepSend (
175
- \ PHPUnit \ Framework \ MockObject \ Matcher \ InvokedCount $ sendExpects ,
176
- \ PHPUnit \ Framework \ MockObject \ Matcher \ InvokedCount $ sendCopyToExpects
191
+ InvokedCount $ sendExpects ,
192
+ InvokedCount $ sendCopyToExpects
177
193
) {
178
- $ senderMock = $ this ->createPartialMock (\ Magento \ Sales \ Model \ Order \ Email \ Sender::class, ['send ' , 'sendCopyTo ' ]);
194
+ $ senderMock = $ this ->createPartialMock (Sender::class, ['send ' , 'sendCopyTo ' ]);
179
195
$ senderMock ->expects ($ sendExpects )
180
196
->method ('send ' );
181
197
$ senderMock ->expects ($ sendCopyToExpects )
0 commit comments