/** * @covers \Magento\Bundle\Pricing\Price\TierPrice::isFirstPriceBetter * @dataProvider providerForGetterTierPriceList */ public function testGetterTierPriceList($tierPrices, $basePrice, $expectedResult) { $this->product->setData(TierPrice::PRICE_CODE, $tierPrices); $price = $this->getMock('Magento\\Framework\\Pricing\\Price\\PriceInterface'); $price->expects($this->any())->method('getValue')->will($this->returnValue($basePrice)); $this->priceInfo->expects($this->any())->method('getPrice')->will($this->returnValue($price)); $this->calculator->expects($this->atLeastOnce())->method('getAmount')->will($this->returnArgument(0)); $this->assertEquals($expectedResult, $this->model->getTierPriceList()); $this->assertEquals(count($expectedResult), $this->model->getTierPriceCount()); }
/** * @covers \Magento\Bundle\Pricing\Price\TierPrice::isFirstPriceBetter * @dataProvider providerForGetterTierPriceList */ public function testGetterTierPriceList($tierPrices, $basePrice, $expectedResult) { $this->product->setData(TierPrice::PRICE_CODE, $tierPrices); $price = $this->getMock('Magento\\Framework\\Pricing\\Price\\PriceInterface'); $price->expects($this->any())->method('getValue')->will($this->returnValue($basePrice)); $this->priceInfo->expects($this->any())->method('getPrice')->will($this->returnValue($price)); $this->calculator->expects($this->atLeastOnce())->method('getAmount')->will($this->returnArgument(0)); $this->priceCurrencyMock->expects($this->never())->method('convertAndRound'); $group = $this->getMock('\\Magento\\Customer\\Model\\Data\\Group', [], [], '', false); $group->expects($this->any())->method('getId')->willReturn(\Magento\Customer\Model\GroupManagement::CUST_GROUP_ALL); $this->groupManagement->expects($this->any())->method('getAllCustomersGroup')->will($this->returnValue($group)); $this->assertEquals($expectedResult, $this->model->getTierPriceList()); $this->assertEquals(count($expectedResult), $this->model->getTierPriceCount()); }
/** * @dataProvider providerForTestGetSavePercent */ public function testGetSavePercent($baseAmount, $savePercent) { $amount = $this->getMockForAbstractClass('Magento\\Framework\\Pricing\\Amount\\AmountInterface'); $amount->expects($this->once())->method('getBaseAmount')->willReturn($baseAmount); $this->assertEquals($savePercent, $this->model->getSavePercent($amount)); }