22 $this->relatedProductTypes = [
'type1',
'type2',
'type3'];
23 $this->model = new \Magento\Quote\Model\Quote\Item\RelatedProducts($this->relatedProductTypes);
37 $itemOptionMock = $this->createPartialMock(
39 [
'getValue',
'getProductId',
'__wakeup']
42 $quoteItemMock->expects(
49 $this->returnValue($itemOptionMock)
52 $itemOptionMock->expects($this->once())->method(
'getValue')->will($this->returnValue(
$optionValue));
54 $itemOptionMock->expects($this->any())->method(
'getProductId')->will($this->returnValue(
$productId));
56 $this->assertEquals($expectedResult, $this->model->getRelatedProductIds([$quoteItemMock]));
70 [
'optionValue' =>
'type1',
'productId' => 123,
'expectedResult' => [123]],
71 [
'optionValue' =>
'other_type',
'productId' => 123,
'expectedResult' => []],
72 [
'optionValue' =>
'type1',
'productId' =>
null,
'expectedResult' => []],
73 [
'optionValue' =>
'other_type',
'productId' =>
false,
'expectedResult' => []]
84 $quoteItemMock->expects(
91 $this->returnValue(
new \stdClass())
94 $this->assertEquals([], $this->model->getRelatedProductIds([$quoteItemMock]));