55 */
66namespace Magento \Wishlist \Test \Unit \Pricing \ConfiguredPrice ;
77
8- use Magento \Framework \Pricing \Adjustment \CalculatorInterface ;
9- use Magento \Framework \Pricing \PriceCurrencyInterface ;
10- use Magento \Framework \Pricing \PriceInfoInterface ;
11- use Magento \Framework \Pricing \SaleableInterface ;
12- use Magento \Wishlist \Pricing \ConfiguredPrice \ConfigurableProduct ;
13-
148class ConfigurableProductTest extends \PHPUnit_Framework_TestCase
159{
1610 /**
17- * @var SaleableInterface|\PHPUnit_Framework_MockObject_MockObject
11+ * @var \Magento\Framework\Pricing\ SaleableInterface|\PHPUnit_Framework_MockObject_MockObject
1812 */
1913 private $ saleableItem ;
2014
2115 /**
22- * @var CalculatorInterface|\PHPUnit_Framework_MockObject_MockObject
16+ * @var \Magento\Framework\Pricing\Adjustment\ CalculatorInterface|\PHPUnit_Framework_MockObject_MockObject
2317 */
2418 private $ calculator ;
2519
2620 /**
27- * @var PriceCurrencyInterface|\PHPUnit_Framework_MockObject_MockObject
21+ * @var \Magento\Framework\Pricing\ PriceCurrencyInterface|\PHPUnit_Framework_MockObject_MockObject
2822 */
2923 private $ priceCurrency ;
3024
3125 /**
32- * @var ConfigurableProduct
26+ * @var \Magento\Wishlist\Pricing\ConfiguredPrice\ ConfigurableProduct
3327 */
3428 private $ model ;
3529
3630 /**
37- * @var PriceInfoInterface|\PHPUnit_Framework_MockObject_MockObject
31+ * @var \Magento\Framework\Pricing\ PriceInfoInterface|\PHPUnit_Framework_MockObject_MockObject
3832 */
3933 private $ priceInfoMock ;
4034
@@ -49,17 +43,14 @@ protected function setUp()
4943 'getCustomOption ' ,
5044 ])
5145 ->getMockForAbstractClass ();
52- $ this ->saleableItem ->expects ($ this ->once ())
53- ->method ('getPriceInfo ' )
54- ->willReturn ($ this ->priceInfoMock );
5546
5647 $ this ->calculator = $ this ->getMockBuilder ('Magento\Framework\Pricing\Adjustment\CalculatorInterface ' )
5748 ->getMockForAbstractClass ();
5849
5950 $ this ->priceCurrency = $ this ->getMockBuilder ('Magento\Framework\Pricing\PriceCurrencyInterface ' )
6051 ->getMockForAbstractClass ();
6152
62- $ this ->model = new ConfigurableProduct (
53+ $ this ->model = new \ Magento \ Wishlist \ Pricing \ ConfiguredPrice \ ConfigurableProduct (
6354 $ this ->saleableItem ,
6455 null ,
6556 $ this ->calculator ,
@@ -82,7 +73,7 @@ public function testGetValue()
8273 ->getMock ();
8374 $ this ->priceInfoMock ->expects ($ this ->once ())
8475 ->method ('getPrice ' )
85- ->with (ConfigurableProduct::PRICE_CODE )
76+ ->with (\ Magento \ Wishlist \ Pricing \ ConfiguredPrice \ ConfigurableProduct::PRICE_CODE )
8677 ->willReturn ($ priceMock );
8778
8879 $ productMock = $ this ->getMockBuilder ('Magento\Catalog\Model\Product ' )
@@ -109,11 +100,28 @@ public function testGetValue()
109100
110101 public function testGetValueWithNoCustomOption ()
111102 {
103+ $ priceValue = 100 ;
104+
105+ $ priceMock = $ this ->getMockBuilder (\Magento \Framework \Pricing \Price \PriceInterface::class)
106+ ->getMockForAbstractClass ();
107+ $ priceMock ->expects ($ this ->once ())
108+ ->method ('getValue ' )
109+ ->willReturn ($ priceValue );
110+
112111 $ this ->saleableItem ->expects ($ this ->once ())
113112 ->method ('getCustomOption ' )
114113 ->with ('simple_product ' )
115114 ->willReturn (null );
116115
117- $ this ->assertEquals (0 , $ this ->model ->getValue ());
116+ $ this ->saleableItem ->expects ($ this ->once ())
117+ ->method ('getPriceInfo ' )
118+ ->willReturn ($ this ->priceInfoMock );
119+
120+ $ this ->priceInfoMock ->expects ($ this ->once ())
121+ ->method ('getPrice ' )
122+ ->with (\Magento \Wishlist \Pricing \ConfiguredPrice \ConfigurableProduct::PRICE_CODE )
123+ ->willReturn ($ priceMock );
124+
125+ $ this ->assertEquals (100 , $ this ->model ->getValue ());
118126 }
119127}
0 commit comments