@@ -85,6 +85,11 @@ class MassUnholdTest extends \PHPUnit\Framework\TestCase
85
85
*/
86
86
protected $ filterMock ;
87
87
88
+ /**
89
+ * @var \PHPUnit_Framework_MockObject_MockObject
90
+ */
91
+ private $ orderManagementMock ;
92
+
88
93
protected function setUp ()
89
94
{
90
95
$ objectManagerHelper = new ObjectManagerHelper ($ this );
@@ -146,12 +151,15 @@ protected function setUp()
146
151
->method ('create ' )
147
152
->willReturn ($ this ->orderCollectionMock );
148
153
154
+ $ this ->orderManagementMock = $ this ->createMock (\Magento \Sales \Api \OrderManagementInterface::class);
155
+
149
156
$ this ->massAction = $ objectManagerHelper ->getObject (
150
157
\Magento \Sales \Controller \Adminhtml \Order \MassUnhold::class,
151
158
[
152
159
'context ' => $ this ->contextMock ,
153
160
'filter ' => $ this ->filterMock ,
154
- 'collectionFactory ' => $ this ->orderCollectionFactoryMock
161
+ 'collectionFactory ' => $ this ->orderCollectionFactoryMock ,
162
+ 'orderManagement ' => $ this ->orderManagementMock
155
163
]
156
164
);
157
165
}
@@ -175,9 +183,7 @@ public function testExecuteOneOrdersReleasedFromHold()
175
183
->method ('canUnhold ' )
176
184
->willReturn (true );
177
185
$ order1 ->expects ($ this ->once ())
178
- ->method ('unhold ' );
179
- $ order1 ->expects ($ this ->once ())
180
- ->method ('save ' );
186
+ ->method ('getEntityId ' );
181
187
182
188
$ this ->orderCollectionMock ->expects ($ this ->once ())
183
189
->method ('count ' )
@@ -187,6 +193,8 @@ public function testExecuteOneOrdersReleasedFromHold()
187
193
->method ('canUnhold ' )
188
194
->willReturn (false );
189
195
196
+ $ this ->orderManagementMock ->expects ($ this ->atLeastOnce ())->method ('unHold ' )->willReturn (true );
197
+
190
198
$ this ->messageManagerMock ->expects ($ this ->once ())
191
199
->method ('addError ' )
192
200
->with ('1 order(s) were not released from on hold status. ' );
0 commit comments