Skip to content

Commit 745b8f8

Browse files
author
Volodymyr Kublytskyi
authored
Merge pull request magento#895 from magento-engcom/MSI-788-Synchronization-With-Core
MSI-788: Synchronization with core.
2 parents daedcca + 8b2a6fa commit 745b8f8

File tree

5 files changed

+12
-10
lines changed

5 files changed

+12
-10
lines changed

app/code/Magento/InventoryShipping/Model/ShipmentProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function __construct(
2929
/**
3030
* @inheritdoc
3131
*/
32-
public function getShipment(): array
32+
public function getShipmentData(): array
3333
{
3434
$sourceCode = $this->request->getParam('sourceCode');
3535
$items = $this->request->getParam('items', []);

app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/NewAction.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
namespace Magento\Shipping\Controller\Adminhtml\Order\Shipment;
88

99
use Magento\Backend\App\Action;
10+
use Magento\Framework\App\ObjectManager;
1011

1112
class NewAction extends \Magento\Backend\App\Action
1213
{
@@ -35,10 +36,11 @@ class NewAction extends \Magento\Backend\App\Action
3536
public function __construct(
3637
Action\Context $context,
3738
\Magento\Shipping\Controller\Adminhtml\Order\ShipmentLoader $shipmentLoader,
38-
\Magento\Shipping\Model\ShipmentProviderInterface $shipmentProvider
39+
\Magento\Shipping\Model\ShipmentProviderInterface $shipmentProvider = null
3940
) {
4041
$this->shipmentLoader = $shipmentLoader;
41-
$this->shipmentProvider = $shipmentProvider;
42+
$this->shipmentProvider = $shipmentProvider ?: ObjectManager::getInstance()
43+
->get(\Magento\Shipping\Model\ShipmentProviderInterface::class);
4244
parent::__construct($context);
4345
}
4446

@@ -51,7 +53,7 @@ public function execute()
5153
{
5254
$this->shipmentLoader->setOrderId($this->getRequest()->getParam('order_id'));
5355
$this->shipmentLoader->setShipmentId($this->getRequest()->getParam('shipment_id'));
54-
$this->shipmentLoader->setShipment($this->shipmentProvider->getShipment());
56+
$this->shipmentLoader->setShipment($this->shipmentProvider->getShipmentData());
5557
$this->shipmentLoader->setTracking($this->getRequest()->getParam('tracking'));
5658
$shipment = $this->shipmentLoader->load();
5759
if ($shipment) {

app/code/Magento/Shipping/Model/ShipmentProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct(RequestInterface $request)
3030
/**
3131
* @inheritdoc
3232
*/
33-
public function getShipment(): array
33+
public function getShipmentData(): array
3434
{
3535
return $this->request->getParam('shipment', []);
3636
}

app/code/Magento/Shipping/Model/ShipmentProviderInterface.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@
88
namespace Magento\Shipping\Model;
99

1010
/**
11-
* Provide shipment items data from request.
11+
* Provide shipment items data.
1212
*
1313
* @api
1414
*/
1515
interface ShipmentProviderInterface
1616
{
1717
/**
18-
* Retrieve shipment items from request.
18+
* Retrieve shipment items.
1919
*
2020
* @return array
2121
*/
22-
public function getShipment(): array;
22+
public function getShipmentData(): array;
2323
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ protected function setUp()
135135
);
136136
$this->shipmentProviderMock = $this->getMockBuilder(\Magento\Shipping\Model\ShipmentProviderInterface::class)
137137
->disableOriginalConstructor()
138-
->setMethods(['getShipment'])
138+
->setMethods(['getShipmentData'])
139139
->getMockForAbstractClass();
140140
$this->actionFlag = $this->createPartialMock(\Magento\Framework\App\ActionFlag::class, ['get']);
141141
$this->helper = $this->createPartialMock(\Magento\Backend\Helper\Data::class, ['getUrl']);
@@ -270,7 +270,7 @@ public function testExecute()
270270
->with('menu')
271271
->will($this->returnValue($menuBlock));
272272
$this->shipmentProviderMock->expects($this->once())
273-
->method('getShipment')
273+
->method('getShipmentData')
274274
->willReturn($shipmentData);
275275

276276
$this->assertNull($this->newAction->execute());

0 commit comments

Comments
 (0)