10 use Magento\Catalog\Api\Data\ProductRender\PriceInfoInterfaceFactory;
28 private $priceCurrencyMock;
33 private $priceInfoFactory;
38 private $formattedPriceInfoBuilder;
42 $this->priceCurrencyMock = $this->getMockBuilder(PriceCurrencyInterface::class)
43 ->getMockForAbstractClass();
44 $this->priceInfoFactory = $this->getMockBuilder(PriceInfoInterfaceFactory::class)
45 ->disableOriginalConstructor()
46 ->setMethods([
'create'])
48 $this->formattedPriceInfoBuilder = $this->getMockBuilder(FormattedPriceInfoBuilder::class)
49 ->disableOriginalConstructor()
53 $this->priceCurrencyMock,
54 $this->priceInfoFactory,
55 $this->formattedPriceInfoBuilder
64 $currencyCode =
'usd';
66 $productMock = $this->getMockBuilder(Product::class)
67 ->disableOriginalConstructor()
69 $price = $this->getMockBuilder(FinalPrice::class)
70 ->disableOriginalConstructor()
72 $productRender = $this->getMockBuilder(ProductRenderInterface::class)
73 ->disableOriginalConstructor()
75 $amount = $this->getMockBuilder(AmountInterface::class)
76 ->disableOriginalConstructor()
78 $minAmount = $this->getMockBuilder(AmountInterface::class)
79 ->disableOriginalConstructor()
81 $priceInfo = $this->getMockBuilder(PriceInfoInterface::class)
88 'setMinimalRegularPrice' 91 ->getMockForAbstractClass();
93 $productMock->expects($this->once())
95 ->willReturn(
'bundle');
96 $productRender->expects($this->exactly(2))
97 ->method(
'getPriceInfo')
98 ->willReturn($priceInfo);
99 $priceInfo->expects($this->once())
100 ->method(
'setMaxPrice')
101 ->with($amountValue);
102 $priceInfo->expects($this->once())
103 ->method(
'setMaxRegularPrice')
104 ->with($amountValue);
105 $priceInfo->expects($this->once())
106 ->method(
'setMinimalPrice')
107 ->with($minAmountValue);
108 $priceInfo->expects($this->once())
109 ->method(
'setMinimalRegularPrice')
110 ->with($minAmountValue);
111 $productMock->expects($this->exactly(4))
112 ->method(
'getPriceInfo')
113 ->willReturn($priceInfo);
114 $productMock->expects($this->any())
115 ->method(
'getPriceInfo')
116 ->willReturn($priceInfo);
117 $priceInfo->expects($this->exactly(4))
120 $price->expects($this->exactly(2))
121 ->method(
'getMaximalPrice')
123 $price->expects($this->exactly(2))
124 ->method(
'getMinimalPrice')
125 ->willReturn($minAmount);
126 $amount->expects($this->exactly(2))
128 ->willReturn($amountValue);
129 $minAmount->expects($this->exactly(2))
131 ->willReturn($minAmountValue);
133 $productRender->expects($this->once())
134 ->method(
'getStoreId')
136 $productRender->expects($this->once())
137 ->method(
'getCurrencyCode')
138 ->willReturn($currencyCode);
140 $this->formattedPriceInfoBuilder->expects($this->once())
142 ->with($priceInfo,
$storeId, $currencyCode);
143 $productRender->expects($this->once())
144 ->method(
'setPriceInfo')
147 $this->model->collect($productMock, $productRender);