public function testGetMaximalPrice() { $expectedResult = 5; $this->saleableInterfaceMock->expects($this->once())->method('getPrice')->will($this->returnValue($expectedResult)); $this->bundleCalculatorMock->expects($this->once())->method('getMaxRegularAmount')->with($expectedResult, $this->saleableInterfaceMock)->will($this->returnValue($expectedResult)); $this->priceCurrencyMock->expects($this->once())->method('convertAndRound')->will($this->returnArgument(0)); $result = $this->regularPrice->getMaximalPrice(); $this->assertEquals($expectedResult, $result, 'Incorrect amount'); //Calling a second time, should use cached value $result = $this->regularPrice->getMaximalPrice(); $this->assertEquals($expectedResult, $result, 'Incorrect amount the second time'); }
public function testGetMaximalPriceForFixedPriceBundleWithOption() { $price = 5; $maxOptionPrice = 2; $expectedPrice = $price + $maxOptionPrice; $this->priceInfoMock->expects($this->atLeastOnce())->method('getPrice')->with(CustomOptionPrice::PRICE_CODE)->willReturn($this->customOptionPriceMock); $this->customOptionPriceMock->expects($this->once())->method('getCustomOptionRange')->with(false)->willReturn($maxOptionPrice); $this->saleableInterfaceMock->expects($this->once())->method('getPriceType')->willReturn(Price::PRICE_TYPE_FIXED); $this->saleableInterfaceMock->expects($this->once())->method('getPrice')->will($this->returnValue($price)); $this->bundleCalculatorMock->expects($this->once())->method('getMaxRegularAmount')->with($expectedPrice, $this->saleableInterfaceMock)->will($this->returnValue($expectedPrice)); $this->priceCurrencyMock->expects($this->once())->method('convertAndRound')->will($this->returnArgument(0)); $result = $this->regularPrice->getMaximalPrice(); $this->assertEquals($expectedPrice, $result, 'Incorrect amount'); //Calling a second time, should use cached value $result = $this->regularPrice->getMaximalPrice(); $this->assertEquals($expectedPrice, $result, 'Incorrect amount the second time'); }