/**
  * test method getValue
  *
  * @dataProvider getValueDataProvider
  */
 public function testGetValue($specialPriceValue, $expectedResult)
 {
     $this->priceInfoMock->expects($this->once())->method('getPrices')->will($this->returnValue($this->prices));
     $this->regularPriceMock->expects($this->exactly(3))->method('getValue')->will($this->returnValue(100));
     $this->tearPriceMock->expects($this->exactly(2))->method('getValue')->will($this->returnValue(99));
     $this->specialPriceMock->expects($this->any())->method('getValue')->will($this->returnValue($specialPriceValue));
     $this->assertSame($expectedResult, $this->basePrice->getValue());
 }
 /**
  * Returns percent discount
  *
  * @return bool|float
  */
 public function getDiscountPercent()
 {
     if ($this->percent === null) {
         $percent = parent::getValue();
         $this->percent = $percent ? max(0, min(100, 100 - $percent)) : null;
     }
     return $this->percent;
 }
 /**
  * @covers \Magento\Catalog\Pricing\Price\TierPrice::__construct
  * @covers \Magento\Catalog\Pricing\Price\TierPrice::getSavePercent
  * @covers \Magento\Catalog\Pricing\Price\TierPrice::getBasePrice
  * @dataProvider dataProviderGetSavePercent
  */
 public function testGetSavePercent($basePrice, $tierPrice, $savedPercent)
 {
     $price = $this->getMock('Magento\\Framework\\Pricing\\Price\\PriceInterface');
     $this->priceInfo->expects(static::atLeastOnce())->method('getPrice')->with(FinalPrice::PRICE_CODE)->willReturn($price);
     $price->expects(static::atLeastOnce())->method('getValue')->willReturn($basePrice);
     $amount = $this->getMockForAbstractClass('Magento\\Framework\\Pricing\\Amount\\AmountInterface');
     $amount->expects($this->atLeastOnce())->method('getBaseAmount')->will($this->returnValue($tierPrice));
     $this->assertEquals($savedPercent, $this->model->getSavePercent($amount));
 }