/** * situation: one product is supplying the price, which could be a price of zero (0) * * @dataProvider testResolvePriceDataProvider */ public function testResolvePrice($expectedValue) { $price = $expectedValue; $product = $this->getMockBuilder(\Magento\Catalog\Model\Product::class)->disableOriginalConstructor()->getMock(); $product->expects($this->never())->method('getSku'); $this->cofigurableOptionProvider->expects($this->once())->method('getProducts')->willReturn([$product]); $this->priceResolver->expects($this->atLeastOnce())->method('resolvePrice')->willReturn($price); $this->assertEquals($expectedValue, $this->resolver->resolvePrice($product)); }
/** * situation: one product is supplying the price, which could be a price of zero (0) * * @dataProvider testResolvePriceDataProvider */ public function testResolvePrice($expectedValue) { $price = $expectedValue; $product = $this->getMockForAbstractClass('Magento\\Framework\\Pricing\\SaleableInterface', [], '', false, true, true, ['getName']); $product->expects($this->never())->method('getName'); $this->configurable->expects($this->once())->method('getUsedProducts')->willReturn([$product]); $this->priceResolver->expects($this->atLeastOnce())->method('resolvePrice')->willReturn($price); $this->assertEquals($expectedValue, $this->resolver->resolvePrice($product)); }