8 use \Magento\Framework\Pricing\Render;
47 $this->priceLayout = $this->getMockBuilder(\
Magento\Framework\Pricing\
Render\Layout::class)
48 ->disableOriginalConstructor()
51 $this->price = $this->getMockBuilder(\
Magento\Framework\Pricing\Price\PriceInterface::class)
52 ->disableOriginalConstructor()
53 ->getMockForAbstractClass();
56 ->disableOriginalConstructor()
59 $this->saleableItem = $this->getMockBuilder(\
Magento\Framework\Pricing\SaleableInterface::class)
60 ->disableOriginalConstructor()
61 ->getMockForAbstractClass();
63 $this->renderPool = $this->getMockBuilder(\
Magento\Framework\Pricing\
Render\RendererPool::class)
64 ->disableOriginalConstructor()
67 $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
69 \
Magento\Framework\Pricing\Render::class,
71 'priceLayout' => $this->priceLayout
78 $priceRenderHandle =
'price_render_handle';
80 $this->priceLayout->expects($this->once())
82 ->with($priceRenderHandle);
84 $this->priceLayout->expects($this->once())
85 ->method(
'loadLayout');
87 $layout = $this->createMock(\
Magento\Framework\View\LayoutInterface::class);
88 $this->model->setPriceRenderHandle($priceRenderHandle);
89 $this->model->setLayout($layout);
101 $this->priceLayout->expects($this->once())
103 ->with(
'render.product.prices')
104 ->will($this->returnValue(
false));
115 $pricingRender = $this->createMock(\
Magento\Framework\Pricing\Render::class);
116 $this->renderPool->expects($this->once())
117 ->method(
'createPriceRender')
118 ->will($this->returnValue($pricingRender));
119 $pricingRender->expects($this->once())
121 ->will($this->returnValue(
'simple.final'));
122 $this->priceLayout->expects($this->once())
124 ->with(
'render.product.prices')
125 ->will($this->returnValue($this->renderPool));
134 $pricingRender = $this->createMock(\
Magento\Framework\Pricing\Render::class);
135 $this->renderPool->expects($this->once())
136 ->method(
'createPriceRender')
137 ->will($this->returnValue($pricingRender));
138 $pricingRender->expects($this->once())
140 ->will($this->returnValue(
'default.special'));
141 $this->priceLayout->expects($this->once())
143 ->with(
'render.product.prices')
144 ->will($this->returnValue($this->renderPool));
155 $pricingRender = $this->createMock(\
Magento\Framework\Pricing\Render::class);
156 $this->renderPool->expects($this->once())
157 ->method(
'createPriceRender')
158 ->will($this->returnValue($pricingRender));
159 $pricingRender->expects($this->once())
161 ->will($this->returnValue(
'default.default'));
162 $this->priceLayout->expects($this->once())
164 ->with(
'render.product.prices')
165 ->will($this->returnValue($this->renderPool));
173 $expectedResult =
'default.default';
175 $pricingRender = $this->createMock(
178 $this->renderPool->expects($this->once())
179 ->method(
'createAmountRender')
181 $this->equalTo($this->
amount),
182 $this->equalTo($this->saleableItem),
183 $this->equalTo($this->price),
186 ->will($this->returnValue($pricingRender));
187 $pricingRender->expects($this->once())
189 ->will($this->returnValue(
'default.default'));
190 $this->priceLayout->expects($this->once())
192 ->with(
'render.product.prices')
193 ->will($this->returnValue($this->renderPool));
196 $this->assertEquals($expectedResult,
$result);
205 $this->priceLayout->expects($this->once())
207 ->with(
'render.product.prices')
208 ->will($this->returnValue(
false));
210 $this->model->renderAmount($this->
amount, $this->price, $this->saleableItem);
testAmountRenderNoRenderPool()
if( $block->displayPriceExclTax()||$block->displayBothPrices())(__('Excl. Tax')) ?>"> <?php if ($block -> displayPriceWithWeeeDetails()): ?> <span class="cart-tax-total" data-mage-init=' Magento Weee Helper Data Magento Weee Helper Data title amount
testRenderDefaultDefault()
testRenderWithoutRenderList()