9 use \Magento\Sales\Api\OrderRepositoryInterface;
29 $this->orderRepository = $this->createMock(\
Magento\Sales\Api\OrderRepositoryInterface::class);
31 $objectManagerHelper =
new ObjectManagerHelper($this);
33 'context' => $this->createMock(\
Magento\Framework\Model\Context::class),
34 'registry' => $this->createMock(\
Magento\Framework\Registry::class),
35 'localeDate' => $this->createMock(
36 \
Magento\Framework\Stdlib\DateTime\TimezoneInterface::class
38 'dateTime' => $this->createMock(\
Magento\Framework\Stdlib\DateTime::class),
40 'shipmentItemCollectionFactory' => $this->createMock(
43 'trackCollectionFactory' => $this->createMock(
46 'commentFactory' => $this->createMock(\
Magento\Sales\Model\
Order\
Shipment\CommentFactory::class),
47 'commentCollectionFactory' => $this->createMock(
51 $this->shipment = $objectManagerHelper->getObject(
60 $this->shipment->setOrderId($orderId);
61 $entityName =
'shipment';
62 $order = $this->createPartialMock(
63 \
Magento\Sales\Model\Order::class,
64 [
'load',
'setHistoryEntityName',
'__wakeUp']
66 $this->shipment->setOrderId($orderId);
67 $order->expects($this->atLeastOnce())
68 ->method(
'setHistoryEntityName')
70 ->will($this->returnSelf());
72 $this->orderRepository->expects($this->atLeastOnce())
74 ->will($this->returnValue(
$order));
76 $this->assertEquals(
$order, $this->shipment->getOrder());
81 $this->assertEquals(
'shipment', $this->shipment->getEntityType());