Skip to content

Commit 299d9d7

Browse files
committed
MAGETWO-58987: Copy paste detector fails in Tax module
1 parent e676f9f commit 299d9d7

File tree

2 files changed

+30
-21
lines changed

2 files changed

+30
-21
lines changed

app/code/Magento/Tax/Model/Calculation/UnitBaseCalculator.php

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,6 @@
99

1010
class UnitBaseCalculator extends AbstractCalculator
1111
{
12-
/**
13-
* {@inheritdoc}
14-
*/
15-
protected function roundAmount(
16-
$amount,
17-
$rate = null,
18-
$direction = null,
19-
$type = self::KEY_REGULAR_DELTA_ROUNDING,
20-
$round = true,
21-
$item = null
22-
) {
23-
if ($item->getAssociatedItemCode()) {
24-
// Use delta rounding of the product's instead of the weee's
25-
$type = $type . $item->getAssociatedItemCode();
26-
} else {
27-
$type = $type . $item->getCode();
28-
}
29-
30-
return $this->deltaRound($amount, $rate, $direction, $type, $round);
31-
}
32-
3312
/**
3413
* {@inheritdoc}
3514
*/
@@ -103,6 +82,35 @@ protected function calculateWithTaxInPrice(QuoteDetailsItemInterface $item, $qua
10382
->setAppliedTaxes($appliedTaxes);
10483
}
10584

85+
/**
86+
* Round amount.
87+
*
88+
* @param float $amount
89+
* @param null|string $rate
90+
* @param null|bool $direction
91+
* @param string $type
92+
* @param bool $round
93+
* @param QuoteDetailsItemInterface $item
94+
* @return float
95+
*/
96+
protected function roundAmount(
97+
float $amount,
98+
string $rate = null,
99+
bool $direction = null,
100+
string $type = self::KEY_REGULAR_DELTA_ROUNDING,
101+
bool $round = true,
102+
QuoteDetailsItemInterface $item = null
103+
) {
104+
if ($item->getAssociatedItemCode()) {
105+
// Use delta rounding of the product's instead of the weee's
106+
$type = $type . $item->getAssociatedItemCode();
107+
} else {
108+
$type = $type . $item->getCode();
109+
}
110+
111+
return $this->deltaRound($amount, $rate, $direction, $type, $round);
112+
}
113+
106114
/**
107115
* {@inheritdoc}
108116
*/

app/code/Magento/Weee/Test/Unit/Observer/AfterAddressSaveTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* See COPYING.txt for license details.
55
*/
66
namespace Magento\Weee\Test\Unit\Observer;
7+
78
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
89

910
class AfterAddressSaveTest extends \PHPUnit\Framework\TestCase

0 commit comments

Comments
 (0)