23 $this->registryMock = $this->createMock(\
Magento\Framework\Registry::class);
25 $this->collectionUpdater = new \Magento\Sales\Model\Grid\CollectionUpdater(
32 $collectionMock = $this->createMock(
36 ->expects($this->once())
38 ->with(
'current_order')
39 ->will($this->returnValue(
false));
40 $collectionMock->expects($this->never())->method(
'setOrderFilter');
42 ->expects($this->once())
43 ->method(
'addOrderInformation')
44 ->with([
'increment_id'])
45 ->will($this->returnSelf());
46 $this->assertEquals($collectionMock, $this->collectionUpdater->update($collectionMock));
51 $collectionMock = $this->createMock(
54 $orderMock = $this->createMock(\
Magento\Sales\Model\Order::class);
56 ->expects($this->once())
58 ->with(
'current_order')
59 ->will($this->returnValue($orderMock));
60 $orderMock->expects($this->once())->method(
'getId')->will($this->returnValue(
'orderId'));
61 $collectionMock->expects($this->once())->method(
'setOrderFilter')->with(
'orderId')->will($this->returnSelf());
63 ->expects($this->once())
64 ->method(
'addOrderInformation')
65 ->with([
'increment_id'])
66 ->will($this->returnSelf());
67 $this->assertEquals($collectionMock, $this->collectionUpdater->update($collectionMock));
testUpdateIfOrderExists()
testUpdateIfOrderNotExists()