44 $this->layoutMock = $this->getMockBuilder(\
Magento\Framework\View\Layout::class)
45 ->disableOriginalConstructor()
47 $this->contextMock = $this->getMockBuilder(\
Magento\Framework\View\Element\Context::class)
48 ->disableOriginalConstructor()
50 $this->contextMock->expects($this->any())
52 ->will($this->returnValue($this->layoutMock));
53 $this->productMock = $this->getMockBuilder(\
Magento\Catalog\Model\Product::class)
54 ->disableOriginalConstructor()
56 $this->priceMock = $this->getMockBuilder(\
Magento\Catalog\Pricing\Price\BasePrice::class)
57 ->disableOriginalConstructor()
70 $priceCode =
'price_test';
73 $this->productMock->expects($this->once())
75 ->will($this->returnValue(
$type));
78 $result = $testedClass->createPriceRender($priceCode, $this->productMock, $methodData);
91 $priceCode =
'price_test';
105 $priceInfoMock = $this->getMockBuilder(\
Magento\Framework\Pricing\PriceInfo\Base::class)
106 ->disableOriginalConstructor()
108 $priceInfoMock->expects($this->once())
110 ->with($this->equalTo($priceCode))
112 $this->productMock->expects($this->once())
113 ->method(
'getTypeId')
114 ->will($this->returnValue(
$type));
115 $this->productMock->expects($this->once())
116 ->method(
'getPriceInfo')
117 ->will($this->returnValue($priceInfoMock));
120 $result = $testedClass->createPriceRender($priceCode, $this->productMock, $methodData);
134 $priceCode =
'price_test';
136 $className = \Magento\Framework\View\Element\Template\Context::class;
147 $priceInfoMock = $this->getMockBuilder(\
Magento\Framework\Pricing\PriceInfo\Base::class)
148 ->disableOriginalConstructor()
150 $priceInfoMock->expects($this->once())
152 ->with($this->equalTo($priceCode))
153 ->will($this->returnValue($this->priceMock));
154 $this->productMock->expects($this->once())
155 ->method(
'getTypeId')
156 ->will($this->returnValue(
$type));
157 $this->productMock->expects($this->once())
158 ->method(
'getPriceInfo')
159 ->will($this->returnValue($priceInfoMock));
162 ->disableOriginalConstructor()
169 'data' => $methodData,
170 'rendererPool' => $testedClass,
174 $this->layoutMock->expects($this->once())
175 ->method(
'createBlock')
177 ->will($this->returnValue(
$block));
179 $result = $testedClass->createPriceRender($priceCode, $this->productMock, $methodData);
189 $priceCode =
'price_test';
191 $className = \Magento\Framework\View\Element\Template\Context::class;
204 $priceInfoMock = $this->getMockBuilder(\
Magento\Framework\Pricing\PriceInfo\Base::class)
205 ->disableOriginalConstructor()
207 $priceInfoMock->expects($this->once())
209 ->with($this->equalTo($priceCode))
210 ->will($this->returnValue($this->priceMock));
211 $this->productMock->expects($this->once())
212 ->method(
'getTypeId')
213 ->will($this->returnValue(
$type));
214 $this->productMock->expects($this->once())
215 ->method(
'getPriceInfo')
216 ->will($this->returnValue($priceInfoMock));
218 $renderBlock = $this->getMockBuilder(\
Magento\Framework\Pricing\
Render\PriceBox::class)
219 ->disableOriginalConstructor()
221 $renderBlock->expects($this->once())
222 ->method(
'setTemplate')
228 'data' => $methodData,
229 'rendererPool' => $testedClass,
233 $this->layoutMock->expects($this->once())
234 ->method(
'createBlock')
236 ->will($this->returnValue($renderBlock));
238 $result = $testedClass->createPriceRender($priceCode, $this->productMock, $methodData);
239 $this->assertInstanceOf(\
Magento\Framework\Pricing\
Render\PriceBoxRenderInterface::class,
$result);
253 $priceCode =
'base_price_test';
255 $amountMock = $this->getMockBuilder(\
Magento\Framework\Pricing\
Amount\Base::class)
256 ->disableOriginalConstructor()
258 $this->productMock->expects($this->once())
259 ->method(
'getTypeId')
260 ->will($this->returnValue(
$type));
261 $this->priceMock->expects($this->once())
262 ->method(
'getPriceCode')
263 ->will($this->returnValue($priceCode));
266 $result = $testedClass->createAmountRender($amountMock, $this->productMock, $this->priceMock, $methodData);
281 $priceCode =
'base_price_test';
282 $amountRenderClass = \Magento\Framework\View\Element\Template\Context::class;
287 'amount_render_class' => $amountRenderClass,
293 $amountMock = $this->getMockBuilder(\
Magento\Framework\Pricing\
Amount\Base::class)
294 ->disableOriginalConstructor()
296 $this->productMock->expects($this->once())
297 ->method(
'getTypeId')
298 ->will($this->returnValue(
$type));
299 $this->priceMock->expects($this->once())
300 ->method(
'getPriceCode')
301 ->will($this->returnValue($priceCode));
304 ->disableOriginalConstructor()
311 'data' => $methodData,
312 'rendererPool' => $testedClass,
313 'amount' => $amountMock,
318 $this->layoutMock->expects($this->once())
319 ->method(
'createBlock')
320 ->with($this->equalTo($amountRenderClass), $this->equalTo(
''), $this->equalTo(
$arguments))
321 ->will($this->returnValue(
$block));
323 $result = $testedClass->createAmountRender($amountMock, $this->productMock, $this->priceMock, $methodData);
334 $priceCode =
'base_price_test';
336 $amountRenderClass = \Magento\Framework\Pricing\Render\Amount::class;
341 'amount_render_class' => $amountRenderClass,
348 $amountMock = $this->getMockBuilder(\
Magento\Framework\Pricing\
Amount\Base::class)
349 ->disableOriginalConstructor()
351 $this->productMock->expects($this->once())
352 ->method(
'getTypeId')
353 ->will($this->returnValue(
$type));
354 $this->priceMock->expects($this->once())
355 ->method(
'getPriceCode')
356 ->will($this->returnValue($priceCode));
358 $blockMock = $this->getMockBuilder(\
Magento\Framework\Pricing\
Render\Amount::class)
359 ->disableOriginalConstructor()
365 'data' => $methodData,
366 'rendererPool' => $testedClass,
367 'amount' => $amountMock,
372 $this->layoutMock->expects($this->once())
373 ->method(
'createBlock')
374 ->with($this->equalTo($amountRenderClass), $this->equalTo(
''), $this->equalTo(
$arguments))
375 ->will($this->returnValue($blockMock));
377 $blockMock->expects($this->once())
378 ->method(
'setTemplate')
381 $result = $testedClass->createAmountRender($amountMock, $this->productMock, $this->priceMock, $methodData);
382 $this->assertInstanceOf(\
Magento\Framework\Pricing\
Render\AmountRenderInterface::class,
$result);
391 $priceCode =
'base_price_test';
392 $this->productMock->expects($this->once())
393 ->method(
'getTypeId')
394 ->will($this->returnValue($typeId));
395 $this->priceMock->expects($this->once())
396 ->method(
'getPriceCode')
397 ->will($this->returnValue($priceCode));
400 $adjustments = [
$code =>
'some data'];
403 'adjustments' => $adjustments,
407 $result = $testedClass->getAdjustmentRenders($this->productMock, $this->priceMock);
417 $priceCode =
'base_price_test';
418 $this->productMock->expects($this->once())
419 ->method(
'getTypeId')
420 ->will($this->returnValue($typeId));
421 $this->priceMock->expects($this->once())
422 ->method(
'getPriceCode')
423 ->will($this->returnValue($priceCode));
428 'adjustment_render_class' =>
'Test',
433 'adjustments' => $adjustments,
438 $result = $testedClass->getAdjustmentRenders($this->productMock, $this->priceMock);
448 $priceCode =
'base_price_test';
449 $class = \Magento\Framework\View\Element\Template::class;
456 'adjustment_render_class' =>
$class,
457 'adjustment_render_template' =>
$template,
463 'adjustments' => $adjustments,
467 $this->productMock->expects($this->once())
468 ->method(
'getTypeId')
469 ->will($this->returnValue($typeId));
470 $this->priceMock->expects($this->once())
471 ->method(
'getPriceCode')
472 ->will($this->returnValue($priceCode));
474 $blockMock = $this->getMockBuilder(\
Magento\Framework\View\Element\Template::class)
475 ->disableOriginalConstructor()
477 $blockMock->expects($this->once())
478 ->method(
'setTemplate')
481 $this->layoutMock->expects($this->once())
482 ->method(
'createBlock')
483 ->with($this->equalTo(
$class))
484 ->will($this->returnValue($blockMock));
487 $result = $testedClass->getAdjustmentRenders($this->productMock, $this->priceMock);
502 $priceCode =
'base_price_test';
504 $amountRenderClass = \Magento\Framework\Pricing\Render\Amount::class;
509 'amount_render_class' => $amountRenderClass,
516 $amountMock = $this->getMockBuilder(\
Magento\Framework\Pricing\
Amount\Base::class)
517 ->disableOriginalConstructor()
520 $this->productMock->expects($this->once())
521 ->method(
'getTypeId')
522 ->will($this->returnValue(
$type));
523 $this->priceMock->expects($this->once())
524 ->method(
'getPriceCode')
525 ->will($this->returnValue($priceCode));
527 $blockMock = $this->getMockBuilder(\
Magento\Framework\Pricing\
Render\Amount::class)
528 ->disableOriginalConstructor()
534 'data' => $methodData,
535 'rendererPool' => $testedClass,
536 'amount' => $amountMock,
541 $this->layoutMock->expects($this->once())
542 ->method(
'createBlock')
543 ->with($this->equalTo($amountRenderClass), $this->equalTo(
''), $this->equalTo(
$arguments))
544 ->will($this->returnValue($blockMock));
546 $result = $testedClass->createAmountRender($amountMock, $this->productMock, $this->priceMock, $methodData);
559 $priceCode =
'price_test';
561 $className = \Magento\Framework\View\Element\Template\Context::class;
574 $priceInfoMock = $this->getMockBuilder(\
Magento\Framework\Pricing\PriceInfo\Base::class)
575 ->disableOriginalConstructor()
577 $priceInfoMock->expects($this->once())
579 ->with($this->equalTo($priceCode))
580 ->will($this->returnValue($this->priceMock));
581 $this->productMock->expects($this->once())
582 ->method(
'getTypeId')
583 ->will($this->returnValue(
$type));
584 $this->productMock->expects($this->once())
585 ->method(
'getPriceInfo')
586 ->will($this->returnValue($priceInfoMock));
588 $renderBlock = $this->getMockBuilder(\
Magento\Framework\Pricing\
Render\PriceBox::class)
589 ->disableOriginalConstructor()
595 'data' => $methodData,
596 'rendererPool' => $testedClass,
600 $this->layoutMock->expects($this->once())
601 ->method(
'createBlock')
603 ->will($this->returnValue($renderBlock));
605 $result = $testedClass->createPriceRender($priceCode, $this->productMock, $methodData);
606 $this->assertInstanceOf(\
Magento\Framework\Pricing\
Render\PriceBoxRenderInterface::class,
$result);
617 return $this->
object = new \Magento\Framework\Pricing\Render\RendererPool($this->contextMock,
$data);
testGetAdjustmentRendersNoRenderTemplate()
testCreatePriceRenderBlockNotPriceBox()
testCreateAmountRenderNotAmountInterface()
testGetAmountRenderBlockTemplateNoTemplate()
testGetAdjustmentRendersNoRenderClass()
testCreatePriceRenderNoClassName()
testGetAdjustmentRenders()
createTestedEntity(array $data=[])
$_option $_optionId $class
testCreatePriceRenderNoPriceModel()
testGetRenderBlockTemplate()
testCreateAmountRenderNoAmountClass()