Skip to content

Commit ec6de6f

Browse files
committed
MAGETWO-54693: Ability to return the product to the stock after Creditmemo API
1 parent 6a86f51 commit ec6de6f

File tree

1 file changed

+14
-1
lines changed
  • app/code/Magento/Shipping/Test/Unit/Controller/Adminhtml/Order/Shipment

1 file changed

+14
-1
lines changed

app/code/Magento/Shipping/Test/Unit/Controller/Adminhtml/Order/Shipment/SaveTest.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
namespace Magento\Shipping\Test\Unit\Controller\Adminhtml\Order\Shipment;
1010

1111
use Magento\Backend\App\Action;
12+
use Magento\Sales\Model\ValidatorResultInterface;
1213
use Magento\Sales\Model\Order\Email\Sender\ShipmentSender;
1314
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
1415
use Magento\Sales\Model\Order\Shipment\ShipmentValidatorInterface;
@@ -96,6 +97,11 @@ class SaveTest extends \PHPUnit_Framework_TestCase
9697
*/
9798
private $shipmentValidatorMock;
9899

100+
/**
101+
* @var ValidatorResultInterface|\PHPUnit_Framework_MockObject_MockObject
102+
*/
103+
private $validationResult;
104+
99105
/**
100106
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
101107
*/
@@ -107,6 +113,9 @@ protected function setUp()
107113
->disableOriginalConstructor()
108114
->setMethods([])
109115
->getMock();
116+
$this->validationResult = $this->getMockBuilder(ValidatorResultInterface::class)
117+
->disableOriginalConstructor()
118+
->getMock();
110119
$this->labelGenerator = $this->getMockBuilder(\Magento\Shipping\Model\Shipping\LabelGenerator::class)
111120
->disableOriginalConstructor()
112121
->setMethods([])
@@ -362,7 +371,11 @@ public function testExecute($formKeyIsValid, $isPost)
362371
$this->shipmentValidatorMock->expects($this->once())
363372
->method('validate')
364373
->with($shipment, [QuantityValidator::class])
365-
->willReturn([]);
374+
->willReturn($this->validationResult);
375+
376+
$this->validationResult->expects($this->once())
377+
->method('hasMessages')
378+
->willReturn(false);
366379

367380
$this->saveAction->execute();
368381
$this->assertEquals($this->response, $this->saveAction->getResponse());

0 commit comments

Comments
 (0)