/** * @param bool $isPriceIncludesTax * @param float $amount * @param float $price * @param $expectedResult * @dataProvider applyAdjustmentDataProvider */ public function testApplyAdjustment($isPriceIncludesTax, $amount, $price, $expectedResult) { $object = $this->getMockBuilder('Magento\\Framework\\Pricing\\Object\\SaleableInterface')->getMock(); $this->taxHelper->expects($this->any())->method('priceIncludesTax')->will($this->returnValue($isPriceIncludesTax)); $this->taxHelper->expects($this->any())->method('getPrice')->with($object, $amount, !$isPriceIncludesTax)->will($this->returnValue($price)); $this->taxHelper->expects($this->any())->method('getPriceUnrounded')->with($object, $amount, !$isPriceIncludesTax)->will($this->returnValue($price)); $this->assertEquals($expectedResult, $this->adjustment->applyAdjustment($amount, $object)); }
/** * @param bool $isPriceIncludesTax * @param float $amount * @param float $price * @param $expectedResult * @dataProvider applyAdjustmentDataProvider */ public function testApplyAdjustment($amount, $price, $expectedResult) { $object = $this->getMockBuilder('Magento\\Framework\\Pricing\\SaleableInterface')->getMock(); $this->catalogHelper->expects($this->any())->method('getTaxPrice')->with($object, $amount, true)->will($this->returnValue($price)); $this->assertEquals($expectedResult, $this->adjustment->applyAdjustment($amount, $object)); }