30 private $objectManagerHelper;
40 private $quoteItemMock;
45 private $quoteItemOptionMock;
54 $this->subjectMock = $this->getMockBuilder(QuoteToOrderItem::class)
55 ->disableOriginalConstructor()
57 $this->quoteItemMock = $this->getMockBuilder(AbstractQuoteItem::class)
58 ->disableOriginalConstructor()
59 ->setMethods([
'getOptions',
'getProduct'])
60 ->getMockForAbstractClass();
61 $this->quoteItemOptionMock = $this->getMockBuilder(QuoteItemOption::class)
62 ->disableOriginalConstructor()
63 ->setMethods([
'getCode'])
65 $this->productMock = $this->getMockBuilder(Product::class)
66 ->disableOriginalConstructor()
69 $this->objectManagerHelper =
new ObjectManagerHelper($this);
70 $this->plugin = $this->objectManagerHelper->getObject(QuoteItemProductOptionPlugin::class);
75 $this->quoteItemMock->expects(static::once())
76 ->method(
'getOptions')
79 $this->plugin->beforeConvert($this->subjectMock, $this->quoteItemMock);
84 $this->quoteItemMock->expects(static::exactly(2))
85 ->method(
'getOptions')
86 ->willReturn([$this->quoteItemOptionMock, $this->quoteItemOptionMock]);
87 $this->quoteItemOptionMock->expects(static::exactly(2))
89 ->willReturnOnConsecutiveCalls(
'someText_8',
'not_int_text');
90 $this->productMock->expects(static::once())
91 ->method(
'getOptionById')
92 ->willReturn(
new DataObject([
'type' => ProductOption::OPTION_TYPE_FILE]));
93 $this->quoteItemMock->expects(static::once())
94 ->method(
'getProduct')
95 ->willReturn($this->productMock);
97 $this->plugin->beforeConvert($this->subjectMock, $this->quoteItemMock);
testBeforeItemToOrderItemEmptyOptions()
testBeforeItemToOrderItemWithOptions()