/** * @dataProvider getValueDataProvider */ public function testGetMaximalPrice($baseAmount) { $result = 3; $this->baseAmount = $baseAmount; $this->prepareMock(); $this->bundleCalculatorMock->expects($this->once())->method('getMaxAmount')->with($this->equalTo($this->baseAmount), $this->equalTo($this->saleableInterfaceMock))->will($this->returnValue($result)); $this->assertSame($result, $this->finalPrice->getMaximalPrice()); //The second call should use cached value $this->assertSame($result, $this->finalPrice->getMaximalPrice()); }
public function testGetMaximalPriceFixedBundleWithOption() { $optionMaxPrice = 2; $this->baseAmount = 5; $result = 7; $this->prepareMock(); $this->saleableInterfaceMock->expects($this->once())->method('getPriceType')->willReturn(Price::PRICE_TYPE_FIXED); $this->customOptionPriceMock->expects($this->once())->method('getCustomOptionRange')->with(false)->willReturn($optionMaxPrice); $this->bundleCalculatorMock->expects($this->once())->method('getMaxAmount')->with($this->equalTo($this->baseAmount + $optionMaxPrice), $this->equalTo($this->saleableInterfaceMock))->will($this->returnValue($result)); $this->assertSame($result, $this->finalPrice->getMaximalPrice()); //The second call should use cached value $this->assertSame($result, $this->finalPrice->getMaximalPrice()); }