From a732ff6e7bd25153e65aa03d039155799bc8835b Mon Sep 17 00:00:00 2001 From: RomanKis Date: Thu, 4 Jan 2018 17:10:22 +0200 Subject: [PATCH] magento/magento2#7760: M2.1.2 : Shipment Tracking REST API should throw an error if order doesn't exist. --- .../Unit/Model/ResourceModel/Order/Shipment/TrackTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/code/Magento/Sales/Test/Unit/Model/ResourceModel/Order/Shipment/TrackTest.php b/app/code/Magento/Sales/Test/Unit/Model/ResourceModel/Order/Shipment/TrackTest.php index ea19ce7d7ff9d..588101167de17 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/ResourceModel/Order/Shipment/TrackTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/ResourceModel/Order/Shipment/TrackTest.php @@ -89,6 +89,8 @@ protected function setUp() */ public function testSave() { + $shipmentMock = $this->createMock(\Magento\Sales\Model\Order\Shipment::class); + $orderMock = $this->createMock(\Magento\Sales\Model\Order::class); $this->entitySnapshotMock->expects($this->once()) ->method('isModified') ->with($this->trackModelMock) @@ -98,6 +100,8 @@ public function testSave() ->with($this->equalTo($this->trackModelMock)) ->will($this->returnValue([])); $this->trackModelMock->expects($this->any())->method('getData')->willReturn([]); + $this->trackModelMock->expects($this->atLeastOnce())->method('getShipment')->willReturn($shipmentMock); + $shipmentMock->expects($this->atLeastOnce())->method('getOrder')->willReturn($orderMock); $this->trackResource->save($this->trackModelMock); $this->assertTrue(true); }