58 $this->saleableItem = $this->createPartialMock(
59 \
Magento\Catalog\Model\Product::class,
60 [
'getPriceInfo',
'__wakeup']
63 $this->priceInfo = $this->createMock(\
Magento\Framework\Pricing\PriceInfo\Base::class);
64 $this->price = $this->createMock(\
Magento\Catalog\Pricing\Price\BasePrice::class);
66 $this->priceInfo->expects($this->any())
67 ->method(
'getAdjustments')
68 ->will($this->returnValue([]));
70 $this->saleableItem->expects($this->any())
71 ->method(
'getPriceInfo')
72 ->will($this->returnValue($this->priceInfo));
74 $this->priceInfo->expects($this->any())
76 ->with($this->equalTo(
'base_price'))
77 ->will($this->returnValue($this->price));
79 $this->calculator = $this->getMockBuilder(\
Magento\Framework\Pricing\Adjustment\Calculator::class)
80 ->disableOriginalConstructor()
83 $this->helper = $this->createPartialMock(
84 \
Magento\Msrp\Helper\Data::class,
85 [
'isShowPriceOnGesture',
'getMsrpPriceMessage',
'canApplyMsrp']
87 $this->config = $this->createPartialMock(\
Magento\Msrp\Model\Config::class, [
'isEnabled']);
89 $this->priceCurrencyMock = $this->createMock(\
Magento\Framework\Pricing\PriceCurrencyInterface::class);
91 $this->
object = new \Magento\Msrp\Pricing\Price\MsrpPrice(
95 $this->priceCurrencyMock,
103 $this->helper->expects($this->once())
104 ->method(
'isShowPriceOnGesture')
105 ->with($this->equalTo($this->saleableItem))
106 ->will($this->returnValue(
true));
108 $this->assertTrue($this->object->isShowPriceOnGesture());
113 $this->helper->expects($this->once())
114 ->method(
'isShowPriceOnGesture')
115 ->with($this->equalTo($this->saleableItem))
116 ->will($this->returnValue(
false));
118 $this->assertFalse($this->object->isShowPriceOnGesture());
123 $expectedMessage =
'test';
124 $this->helper->expects($this->once())
125 ->method(
'getMsrpPriceMessage')
126 ->with($this->equalTo($this->saleableItem))
127 ->will($this->returnValue($expectedMessage));
129 $this->assertEquals($expectedMessage, $this->object->getMsrpPriceMessage());
134 $this->config->expects($this->once())
135 ->method(
'isEnabled')
136 ->will($this->returnValue(
true));
138 $this->assertTrue($this->object->isMsrpEnabled());
143 $this->helper->expects($this->once())
144 ->method(
'canApplyMsrp')
145 ->with($this->equalTo($this->saleableItem))
146 ->will($this->returnValue(
true));
148 $this->assertTrue($this->object->canApplyMsrp($this->saleableItem));
testIsShowPriceOnGestureFalse()
testIsShowPriceOnGestureTrue()
testGetMsrpPriceMessage()
const PRODUCT_QUANTITY_DEFAULT