50 $this->orderItemFactoryMock = $this->createPartialMock(
51 \
Magento\Sales\Api\Data\OrderItemInterfaceFactory::class,
54 $this->objectCopyServiceMock = $this->createMock(\
Magento\Framework\
DataObject\Copy::class);
56 $this->productMock = $this->createMock(\
Magento\Catalog\Model\Product::class);
57 $this->productTypeMock = $this->createMock(\
Magento\Catalog\Model\
Product\
Type\Simple::class);
58 $this->orderItemMock = $this->createMock(\
Magento\Sales\Model\Order\Item::class);
61 $this->converter = new \Magento\Quote\Model\Quote\Item\ToOrderItem(
62 $this->orderItemFactoryMock,
63 $this->objectCopyServiceMock,
73 $this->quoteItemMock->expects($this->exactly(2))
74 ->method(
'getProduct')
75 ->willReturn($this->productMock);
76 $this->productMock->expects($this->once())
77 ->method(
'getTypeInstance')
78 ->willReturn($this->productTypeMock);
79 $this->productTypeMock->expects($this->once())
80 ->method(
'getOrderOptions')
81 ->with($this->productMock)
82 ->willReturn([
'option']);
83 $this->objectCopyServiceMock->expects($this->at(0))
84 ->method(
'getDataFromFieldset')
85 ->with(
'quote_convert_item',
'to_order_item', $this->quoteItemMock)
87 $this->objectCopyServiceMock->expects($this->at(1))
88 ->method(
'getDataFromFieldset')
89 ->with(
'quote_convert_item',
'to_order_item_discount', $this->quoteItemMock)
91 $this->orderItemFactoryMock->expects($this->once())
93 ->willReturn($this->orderItemMock);
94 $this->assertInstanceOf(
95 \
Magento\Sales\Model\Order\Item::class,
96 $this->converter->convert($this->quoteItemMock, [])