@@ -85,6 +85,11 @@ class MassUnholdTest extends \PHPUnit\Framework\TestCase
8585 */
8686 protected $ filterMock ;
8787
88+ /**
89+ * @var \PHPUnit_Framework_MockObject_MockObject
90+ */
91+ private $ orderManagementMock ;
92+
8893 protected function setUp ()
8994 {
9095 $ objectManagerHelper = new ObjectManagerHelper ($ this );
@@ -146,12 +151,15 @@ protected function setUp()
146151 ->method ('create ' )
147152 ->willReturn ($ this ->orderCollectionMock );
148153
154+ $ this ->orderManagementMock = $ this ->createMock (\Magento \Sales \Api \OrderManagementInterface::class);
155+
149156 $ this ->massAction = $ objectManagerHelper ->getObject (
150157 \Magento \Sales \Controller \Adminhtml \Order \MassUnhold::class,
151158 [
152159 'context ' => $ this ->contextMock ,
153160 'filter ' => $ this ->filterMock ,
154- 'collectionFactory ' => $ this ->orderCollectionFactoryMock
161+ 'collectionFactory ' => $ this ->orderCollectionFactoryMock ,
162+ 'orderManagement ' => $ this ->orderManagementMock
155163 ]
156164 );
157165 }
@@ -175,9 +183,7 @@ public function testExecuteOneOrdersReleasedFromHold()
175183 ->method ('canUnhold ' )
176184 ->willReturn (true );
177185 $ order1 ->expects ($ this ->once ())
178- ->method ('unhold ' );
179- $ order1 ->expects ($ this ->once ())
180- ->method ('save ' );
186+ ->method ('getEntityId ' );
181187
182188 $ this ->orderCollectionMock ->expects ($ this ->once ())
183189 ->method ('count ' )
@@ -187,6 +193,8 @@ public function testExecuteOneOrdersReleasedFromHold()
187193 ->method ('canUnhold ' )
188194 ->willReturn (false );
189195
196+ $ this ->orderManagementMock ->expects ($ this ->atLeastOnce ())->method ('unHold ' )->willReturn (true );
197+
190198 $ this ->messageManagerMock ->expects ($ this ->once ())
191199 ->method ('addError ' )
192200 ->with ('1 order(s) were not released from on hold status. ' );
0 commit comments