Skip to content

Commit d8c4e65

Browse files
committed
AC-8063::Upgrade latest available version of allure-framework/allure-phpunit
2 parents a24f85a + b45a10a commit d8c4e65

File tree

14 files changed

+163
-48
lines changed

14 files changed

+163
-48
lines changed

app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/Total/TaxTest.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
*/
2323
class TaxTest extends TestCase
2424
{
25+
/**
26+
* @var float
27+
*/
28+
private const EPSILON = 0.0000000001;
29+
2530
/**
2631
* @var Tax
2732
*/
@@ -118,13 +123,13 @@ function ($price, $type) use (&$roundingDelta) {
118123

119124
//verify invoice data
120125
foreach ($expectedResults['creditmemo_data'] as $key => $value) {
121-
$this->assertEquals($value, $this->creditmemo->getData($key));
126+
$this->assertEqualsWithDelta($value, $this->creditmemo->getData($key), self::EPSILON);
122127
}
123128
//verify invoice item data
124129
foreach ($expectedResults['creditmemo_items'] as $itemKey => $itemData) {
125130
$creditmemoItem = $creditmemoItems[$itemKey];
126131
foreach ($itemData as $key => $value) {
127-
$this->assertEquals($value, $creditmemoItem->getData($key));
132+
$this->assertEqualsWithDelta($value, $creditmemoItem->getData($key), self::EPSILON);
128133
}
129134
}
130135
}

app/code/Magento/Sales/Test/Unit/Model/Order/Invoice/Total/TaxTest.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717

1818
class TaxTest extends TestCase
1919
{
20+
/**
21+
* @var float
22+
*/
23+
private const EPSILON = 0.0000000001;
24+
2025
/**
2126
* @var Tax
2227
*/
@@ -115,13 +120,13 @@ public function testCollect($orderData, $invoiceData, $expectedResults)
115120

116121
//verify invoice data
117122
foreach ($expectedResults['invoice_data'] as $key => $value) {
118-
$this->assertEquals($value, $this->invoice->getData($key));
123+
$this->assertEqualsWithDelta($value, $this->invoice->getData($key), self::EPSILON);
119124
}
120125
//verify invoice item data
121126
foreach ($expectedResults['invoice_items'] as $itemKey => $itemData) {
122127
$invoiceItem = $invoiceItems[$itemKey];
123128
foreach ($itemData as $key => $value) {
124-
$this->assertEquals($value, $invoiceItem->getData($key));
129+
$this->assertEqualsWithDelta($value, $invoiceItem->getData($key), self::EPSILON);
125130
}
126131
}
127132
}

app/code/Magento/SalesRule/Test/Unit/Model/Rule/Action/Discount/ToPercentTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,8 @@ public function calculateDataProvider()
223223
'expectedRuleDiscountQty' => 100,
224224
'expectedDiscountData' => [
225225
'amount' => 98,
226-
'baseAmount' => 59.5,
227-
'originalAmount' => 119,
226+
'baseAmount' => 59.49999999999999,
227+
'originalAmount' => 118.99999999999999,
228228
'baseOriginalAmount' => 80.5,
229229
],
230230
]

app/code/Magento/Tax/Test/Unit/Model/Calculation/RowBaseCalculatorTest.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313

1414
class RowBaseCalculatorTest extends RowBaseAndTotalBaseCalculatorTestCase
1515
{
16+
/**
17+
* @var float
18+
*/
19+
private const EPSILON = 0.0000000001;
20+
1621
/** @var RowBaseCalculator|MockObject */
1722
protected $rowBaseCalculator;
1823

@@ -27,13 +32,21 @@ public function testCalculateWithTaxInPrice()
2732
$this->taxDetailsItem,
2833
$this->calculate($this->rowBaseCalculator, true)
2934
);
30-
$this->assertEquals(self::UNIT_PRICE_INCL_TAX_ROUNDED, $this->taxDetailsItem->getPriceInclTax());
35+
$this->assertEqualsWithDelta(
36+
self::UNIT_PRICE_INCL_TAX_ROUNDED,
37+
$this->taxDetailsItem->getPriceInclTax(),
38+
self::EPSILON
39+
);
3140

3241
$this->assertSame(
3342
$this->taxDetailsItem,
3443
$this->calculate($this->rowBaseCalculator, false)
3544
);
36-
$this->assertEquals(self::UNIT_PRICE_INCL_TAX, $this->taxDetailsItem->getPriceInclTax());
45+
$this->assertEqualsWithDelta(
46+
self::UNIT_PRICE_INCL_TAX,
47+
$this->taxDetailsItem->getPriceInclTax(),
48+
self::EPSILON
49+
);
3750
}
3851

3952
public function testCalculateWithTaxNotInPrice()

app/code/Magento/Tax/Test/Unit/Model/Calculation/TotalBaseCalculatorTest.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313

1414
class TotalBaseCalculatorTest extends RowBaseAndTotalBaseCalculatorTestCase
1515
{
16+
/**
17+
* @var float
18+
*/
19+
private const EPSILON = 0.0000000001;
20+
1621
/** @var MockObject */
1722
protected $totalBaseCalculator;
1823

@@ -27,7 +32,11 @@ public function testCalculateWithTaxInPrice()
2732
$this->taxDetailsItem,
2833
$this->calculate($this->totalBaseCalculator)
2934
);
30-
$this->assertEquals(self::UNIT_PRICE_INCL_TAX_ROUNDED, $this->taxDetailsItem->getPriceInclTax());
35+
$this->assertEqualsWithDelta(
36+
self::UNIT_PRICE_INCL_TAX_ROUNDED,
37+
$this->taxDetailsItem->getPriceInclTax(),
38+
self::EPSILON
39+
);
3140
}
3241

3342
public function testCalculateWithTaxInPriceNoRounding()
@@ -41,7 +50,11 @@ public function testCalculateWithTaxInPriceNoRounding()
4150
$this->taxDetailsItem,
4251
$this->calculate($this->totalBaseCalculator, false)
4352
);
44-
$this->assertEquals(self::UNIT_PRICE_INCL_TAX, $this->taxDetailsItem->getPriceInclTax());
53+
$this->assertEqualsWithDelta(
54+
self::UNIT_PRICE_INCL_TAX,
55+
$this->taxDetailsItem->getPriceInclTax(),
56+
self::EPSILON
57+
);
4558
}
4659

4760
public function testCalculateWithTaxNotInPrice()

app/code/Magento/Tax/Test/Unit/Model/Calculation/UnitBaseCalculatorTest.php

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@
2929
*/
3030
class UnitBaseCalculatorTest extends TestCase
3131
{
32+
/**
33+
* @var float
34+
*/
35+
private const EPSILON = 0.0000000001;
36+
3237
public const STORE_ID = 2300;
3338
public const QUANTITY = 1;
3439
public const UNIT_PRICE = 500;
@@ -161,14 +166,30 @@ public function testCalculateWithTaxInPrice()
161166
$this->assertSame($this->taxDetailsItem, $this->model->calculate($mockItem, self::QUANTITY));
162167
$this->assertSame(self::CODE, $this->taxDetailsItem->getCode());
163168
$this->assertSame(self::TYPE, $this->taxDetailsItem->getType());
164-
$this->assertEquals(self::ROW_TAX_ROUNDED, $this->taxDetailsItem->getRowTax());
165-
$this->assertEquals(self::PRICE_INCL_TAX_ROUNDED, $this->taxDetailsItem->getPriceInclTax());
169+
$this->assertEqualsWithDelta(
170+
self::ROW_TAX_ROUNDED,
171+
$this->taxDetailsItem->getRowTax(),
172+
self::EPSILON
173+
);
174+
$this->assertEqualsWithDelta(
175+
self::PRICE_INCL_TAX_ROUNDED,
176+
$this->taxDetailsItem->getPriceInclTax(),
177+
self::EPSILON
178+
);
166179

167180
$this->assertSame($this->taxDetailsItem, $this->model->calculate($mockItem, self::QUANTITY, false));
168181
$this->assertSame(self::CODE, $this->taxDetailsItem->getCode());
169182
$this->assertSame(self::TYPE, $this->taxDetailsItem->getType());
170-
$this->assertEquals(self::ROW_TAX, $this->taxDetailsItem->getRowTax());
171-
$this->assertEquals(self::PRICE_INCL_TAX, $this->taxDetailsItem->getPriceInclTax());
183+
$this->assertEqualsWithDelta(
184+
self::ROW_TAX,
185+
$this->taxDetailsItem->getRowTax(),
186+
self::EPSILON
187+
);
188+
$this->assertEqualsWithDelta(
189+
self::PRICE_INCL_TAX,
190+
$this->taxDetailsItem->getPriceInclTax(),
191+
self::EPSILON
192+
);
172193
}
173194

174195
public function testCalculateWithTaxNotInPrice()
@@ -192,9 +213,13 @@ public function testCalculateWithTaxNotInPrice()
192213
->willReturn([['id' => 0, 'percent' => 0, 'rates' => []]]);
193214

194215
$this->assertSame($this->taxDetailsItem, $this->model->calculate($mockItem, self::QUANTITY));
195-
$this->assertEquals(self::CODE, $this->taxDetailsItem->getCode());
196-
$this->assertEquals(self::TYPE, $this->taxDetailsItem->getType());
197-
$this->assertEquals(0.0, $this->taxDetailsItem->getRowTax());
216+
$this->assertEqualsWithDelta(
217+
self::CODE,
218+
$this->taxDetailsItem->getCode(),
219+
self::EPSILON
220+
);
221+
$this->assertEqualsWithDelta(self::TYPE, $this->taxDetailsItem->getType(), self::EPSILON);
222+
$this->assertEqualsWithDelta(0.0, $this->taxDetailsItem->getRowTax(), self::EPSILON);
198223
}
199224

200225
/**

app/code/Magento/Tax/Test/Unit/Model/Plugin/OrderSaveTest.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121

2222
class OrderSaveTest extends TestCase
2323
{
24-
const ORDERID = 123;
25-
const ITEMID = 151;
26-
const ORDER_ITEM_ID = 116;
24+
private const ORDERID = 123;
25+
private const ITEMID = 151;
26+
private const ORDER_ITEM_ID = 116;
2727

2828
/**
2929
* @var TaxFactory|MockObject
@@ -388,7 +388,7 @@ public function afterSaveDataProvider(): array
388388
'amount' => 0.66,
389389
'base_amount' => 0.66,
390390
'process' => 0,
391-
'base_real_amount' => 0.36
391+
'base_real_amount' => 0.36000000000000004
392392
],
393393
//federal tax
394394
'36' => [
@@ -402,7 +402,7 @@ public function afterSaveDataProvider(): array
402402
'amount' => 0.66, //combined amount
403403
'base_amount' => 0.66,
404404
'process' => 0,
405-
'base_real_amount' => 0.3 //portion for specific rate
405+
'base_real_amount' => 0.30000000000000004 //portion for specific rate
406406
],
407407
//city tax
408408
'37' => [
@@ -416,7 +416,7 @@ public function afterSaveDataProvider(): array
416416
'amount' => 0.2, //combined amount
417417
'base_amount' => 0.2,
418418
'process' => 0,
419-
'base_real_amount' => 0.18018018018018 //this number is meaningless since this is single rate
419+
'base_real_amount' => 0.18018018018018017 //this number is meaningless since this is single rate
420420
]
421421
],
422422
'expected_item_taxes' => [
@@ -428,8 +428,8 @@ public function afterSaveDataProvider(): array
428428
'associated_item_id' => null,
429429
'amount' => 0.11,
430430
'base_amount' => 0.11,
431-
'real_amount' => 0.06,
432-
'real_base_amount' => 0.06,
431+
'real_amount' => 0.060000000000000005,
432+
'real_base_amount' => 0.060000000000000005,
433433
'taxable_item_type' => 'product'
434434
],
435435
[
@@ -440,8 +440,8 @@ public function afterSaveDataProvider(): array
440440
'associated_item_id' => null,
441441
'amount' => 0.55,
442442
'base_amount' => 0.55,
443-
'real_amount' => 0.3,
444-
'real_base_amount' => 0.3,
443+
'real_amount' => 0.30000000000000004,
444+
'real_base_amount' => 0.30000000000000004,
445445
'taxable_item_type' => 'shipping'
446446
],
447447
[
@@ -638,7 +638,7 @@ public function afterSaveDataProvider(): array
638638
'amount' => 0.66,
639639
'base_amount' => 0.66,
640640
'process' => 0,
641-
'base_real_amount' => 0.36
641+
'base_real_amount' => 0.36000000000000004
642642
],
643643
//federal tax
644644
'36' => [
@@ -652,7 +652,7 @@ public function afterSaveDataProvider(): array
652652
'amount' => 0.66, //combined amount
653653
'base_amount' => 0.66,
654654
'process' => 0,
655-
'base_real_amount' => 0.3 //portion for specific rate
655+
'base_real_amount' => 0.30000000000000004 //portion for specific rate
656656
],
657657
//city tax
658658
'37' => [
@@ -666,7 +666,7 @@ public function afterSaveDataProvider(): array
666666
'amount' => 0.2, //combined amount
667667
'base_amount' => 0.2,
668668
'process' => 0,
669-
'base_real_amount' => 0.18018018018018 //this number is meaningless since this is single rate
669+
'base_real_amount' => 0.18018018018018017 //this number is meaningless since this is single rate
670670
]
671671
],
672672
'expected_item_taxes' => [
@@ -678,8 +678,8 @@ public function afterSaveDataProvider(): array
678678
'associated_item_id' => null,
679679
'amount' => 0.11,
680680
'base_amount' => 0.11,
681-
'real_amount' => 0.06,
682-
'real_base_amount' => 0.06,
681+
'real_amount' => 0.060000000000000005,
682+
'real_base_amount' => 0.060000000000000005,
683683
'taxable_item_type' => 'product'
684684
],
685685
[
@@ -690,8 +690,8 @@ public function afterSaveDataProvider(): array
690690
'associated_item_id' => null,
691691
'amount' => 0.55,
692692
'base_amount' => 0.55,
693-
'real_amount' => 0.3,
694-
'real_base_amount' => 0.3,
693+
'real_amount' => 0.30000000000000004,
694+
'real_base_amount' => 0.30000000000000004,
695695
'taxable_item_type' => 'shipping'
696696
],
697697
[

app/code/Magento/Tax/Test/Unit/Model/Sales/Order/TaxManagementTest.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
*/
2929
class TaxManagementTest extends TestCase
3030
{
31+
/**
32+
* @var float
33+
*/
34+
private const EPSILON = 0.0000000001;
35+
3136
/**
3237
* @var TaxManagement
3338
*/
@@ -134,8 +139,16 @@ public function testGetOrderTaxDetails($orderItemAppliedTaxes, $expected)
134139
$this->assertEquals($expected['code'], $this->appliedTaxDataObject->getCode());
135140
$this->assertEquals($expected['title'], $this->appliedTaxDataObject->getTitle());
136141
$this->assertEquals($expected['tax_percent'], $this->appliedTaxDataObject->getPercent());
137-
$this->assertEquals($expected['real_amount'], $this->appliedTaxDataObject->getAmount());
138-
$this->assertEquals($expected['real_base_amount'], $this->appliedTaxDataObject->getBaseAmount());
142+
$this->assertEqualsWithDelta(
143+
$expected['real_amount'],
144+
$this->appliedTaxDataObject->getAmount(),
145+
self::EPSILON
146+
);
147+
$this->assertEqualsWithDelta(
148+
$expected['real_base_amount'],
149+
$this->appliedTaxDataObject->getBaseAmount(),
150+
self::EPSILON
151+
);
139152
}
140153

141154
/**

app/code/Magento/Tax/Test/Unit/Pricing/AdjustmentTest.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616

1717
class AdjustmentTest extends TestCase
1818
{
19+
/**
20+
* @var float
21+
*/
22+
private const EPSILON = 0.0000000001;
23+
1924
/**
2025
* @var Adjustment
2126
*/
@@ -117,7 +122,11 @@ public function testExtractAdjustment($isPriceIncludesTax, $amount, $price, $exp
117122
->with($object, $amount)
118123
->willReturn($price);
119124

120-
$this->assertEquals($expectedResult, $this->adjustment->extractAdjustment($amount, $object));
125+
$this->assertEqualsWithDelta(
126+
$expectedResult,
127+
$this->adjustment->extractAdjustment($amount, $object),
128+
self::EPSILON
129+
);
121130
}
122131

123132
/**

0 commit comments

Comments
 (0)