9 use \Magento\Tax\Pricing\Adjustment;
37 $this->taxHelper = $this->createMock(\
Magento\Tax\Helper\Data::class);
38 $this->catalogHelper = $this->createMock(\
Magento\Catalog\Helper\Data::class);
39 $this->adjustment =
new Adjustment($this->taxHelper, $this->catalogHelper, $this->sortOrder);
53 $this->taxHelper->expects($this->once())
54 ->method(
'priceIncludesTax')
55 ->will($this->returnValue($expectedResult));
56 $this->assertEquals($expectedResult, $this->adjustment->isIncludedInBasePrice());
64 return [[
true], [
false]];
72 $this->taxHelper->expects($this->once())
73 ->method(
'displayPriceIncludingTax')
74 ->will($this->returnValue($displayPriceIncludingTax));
75 if (!$displayPriceIncludingTax) {
76 $this->taxHelper->expects($this->once())
77 ->method(
'displayBothPrices')
81 $this->assertEquals($expectedResult, $this->adjustment->isIncludedInDisplayPrice());
90 [
false,
false,
false],
106 $object = $this->getMockForAbstractClass(\
Magento\Framework\Pricing\SaleableInterface::class);
108 $this->taxHelper->expects($this->any())
109 ->method(
'priceIncludesTax')
110 ->will($this->returnValue($isPriceIncludesTax));
111 $this->catalogHelper->expects($this->any())
112 ->method(
'getTaxPrice')
114 ->will($this->returnValue(
$price));
116 $this->assertEquals($expectedResult, $this->adjustment->extractAdjustment(
$amount, $object));
125 [
false,
'not_important',
'not_important', 0.00],
126 [
true, 10.1, 0.2, 9.9],
127 [
true, 10.1, 20.3, -10.2],
141 $object = $this->getMockBuilder(\
Magento\Framework\Pricing\SaleableInterface::class)->getMock();
143 $this->catalogHelper->expects($this->any())
144 ->method(
'getTaxPrice')
146 ->will($this->returnValue(
$price));
148 $this->assertEquals($expectedResult, $this->adjustment->applyAdjustment(
$amount, $object));
170 $this->assertEquals($expectedResult, $this->adjustment->isExcludedWith($adjustmentCode));
186 $this->assertEquals($this->sortOrder, $this->adjustment->getSortOrder());
extractAdjustmentDataProvider()
applyAdjustmentDataProvider()
testExtractAdjustment($isPriceIncludesTax, $amount, $price, $expectedResult)
testApplyAdjustment($amount, $price, $expectedResult)
testIsIncludedInDisplayPrice($displayPriceIncludingTax, $displayBothPrices, $expectedResult)
testIsExcludedWith($adjustmentCode, $expectedResult)
isIncludedInBasePriceDataProvider()
testIsIncludedInBasePrice($expectedResult)
isIncludedInDisplayPriceDataProvider()
isExcludedWithDataProvider()