Skip to content

Commit 5b94757

Browse files
committed
test: update assertions to match corrected price calculations
1 parent 1b4ea89 commit 5b94757

11 files changed

+30
-25
lines changed

tests/Cashiers/CashierTestCase.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ protected function show(): void
135135
{
136136
$cashier = $this->cashier;
137137

138+
echo "quantity: {$cashier->quantity()}" . PHP_EOL;
138139
echo "unitPrice GROSS: {$cashier->unitPrice()->gross()}" . PHP_EOL;
139140
echo "unitPrice NET: {$cashier->unitPrice()->net()}" . PHP_EOL;
140141
echo "total Discounts: {$cashier->discounts()->total()}" . PHP_EOL;

tests/Cashiers/Regular/AddChargesTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ public function test_add_charges_recalculate_all_totals(): void
2020
$testing20Charge = Charge::fixed(20, AdjusterMode::PerUnit)->named('TESTING-20'),
2121
);
2222

23+
2324
$this->assertTotals(
2425
Summary::is(
2526
quantity : 6,
26-
unitPrice : self::money(83.0508),
27-
subtotal : self::money(498.3048),
27+
unitPrice : self::money(99.9999),
28+
subtotal : self::money(599.9994),
2829
totalTaxes : self::money(101.6946),
2930
totalCharges : self::money(234.0),
3031
totaDiscounts: self::money(12.0),

tests/Cashiers/Regular/ApplyDiscountTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ public function test_apply_discount_recalculate_all_totals(): void
2323
$this->assertTotals(
2424
Summary::is(
2525
quantity : 6,
26-
unitPrice : self::money(83.0508),
27-
subtotal : self::money(498.3048),
26+
unitPrice : self::money(99.9999),
27+
subtotal : self::money(599.9994),
2828
totalTaxes : self::money(101.6946),
2929
totalCharges : self::money(42.0),
3030
totaDiscounts: self::money(72.0),

tests/Cashiers/Regular/ComplexCalculationsTest.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,16 @@ final class ComplexCalculationsTest extends RegularCashierTestCase
2020
public function test_calculations_are_accurate_in_stressful_situations(): void
2121
{
2222
$summary = $this->initialSummary();
23+
2324
$this->assertTotals($summary);
2425

2526
$this->cashier->update(6);
27+
28+
2629
$this->assertTotals(
2730
$summary->changeTo(
2831
quantity : 6,
29-
subtotal : self::money(170.3388),
32+
subtotal : self::money(219.0000),
3033
totalTaxes : self::money(48.6612),
3134
totalCharges : self::money(10.9500),
3235
totalDiscounts: self::money(32.2800),
@@ -53,10 +56,11 @@ public function test_calculations_are_accurate_in_stressful_situations(): void
5356
);
5457

5558
$this->cashier->update(1);
59+
5660
$this->assertTotals(
5761
$summary->changeTo(
5862
quantity : 1,
59-
subtotal : self::money(28.3898),
63+
subtotal : self::money(36.5000),
6064
totalTaxes : self::money(8.1102),
6165
totalCharges : self::money(5.0),
6266
totalDiscounts: self::money(7.5700),
@@ -92,8 +96,8 @@ private function initialSummary(): Summary
9296
{
9397
return Summary::is(
9498
quantity : 4,
95-
unitPrice : self::money(28.3898),
96-
subtotal : self::money(113.5592),
99+
unitPrice : self::money(36.5000),
100+
subtotal : self::money(146.0000),
97101
totalTaxes : self::money(32.4408),
98102
totalCharges : self::money(7.3000),
99103
totaDiscounts: self::money(21.5200),

tests/Cashiers/Regular/InitialCalculationsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ public function test_initial_calculations_are_correct(): void
1818
$this->assertTotals(
1919
Summary::is(
2020
quantity : 6,
21-
unitPrice : self::money(83.0508),
22-
subtotal : self::money(498.3048),
21+
unitPrice : self::money(99.9999),
22+
subtotal : self::money(599.9994),
2323
totalTaxes : self::money(101.6946),
2424
totalCharges : self::money(42.0),
2525
totaDiscounts: self::money(12.0),

tests/Cashiers/Regular/UpdateQuantityTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ public function test_change_quantity_recalculates_all_totals(): void
2020
$this->assertTotals(
2121
Summary::is(
2222
quantity : 3,
23-
unitPrice : self::money(83.0508),
24-
subtotal : self::money(249.1524),
23+
unitPrice : self::money(99.9999),
24+
subtotal : self::money(299.9997),
2525
totalTaxes : self::money(50.8473),
2626
totalCharges : self::money(21.0),
2727
totaDiscounts: self::money(6.0),

tests/Cashiers/Simple/AddChargesTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ public function test_add_charges_recalculate_all_totals(): void
2828
$this->assertTotals(
2929
Summary::is(
3030
quantity : 10,
31-
unitPrice : self::money(82.6446),
32-
subtotal : self::money(826.4460),
31+
unitPrice : self::money(100.0),
32+
subtotal : self::money(1000.0),
3333
totalTaxes : self::money(173.5540),
3434
totalCharges : self::money(350.4960),
3535
totaDiscounts: self::money(21.5290),

tests/Cashiers/Simple/ApplyDiscountsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ public function test_apply_discount_recalculate_all_totals(): void
2727
$this->assertTotals(
2828
Summary::is(
2929
quantity : 10,
30-
unitPrice : self::money(82.6446),
31-
subtotal : self::money(826.4460),
30+
unitPrice : self::money(100.0000),
31+
subtotal : self::money(1000.0000),
3232
totalTaxes : self::money(173.5540),
3333
totalCharges : self::money(51.3220),
3434
totaDiscounts: self::money(104.1730),

tests/Cashiers/Simple/ComplexCalculationsTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function test_calculations_are_accurate_in_stressful_situations(): void
3232
$this->assertTotals(
3333
$summary->changeTo(
3434
quantity : 3,
35-
subtotal : self::money(85.1694),
35+
subtotal : self::money(108.0000),
3636
totalTaxes : self::money(22.8306),
3737
totalCharges : self::money(0),
3838
totalDiscounts: self::money(1.7034),
@@ -72,7 +72,7 @@ public function test_calculations_are_accurate_in_stressful_situations(): void
7272
$this->assertTotals(
7373
$summary->changeTo(
7474
quantity : 9,
75-
subtotal : self::money(255.5082),
75+
subtotal : self::money(324.0000),
7676
totalTaxes : self::money(68.4918),
7777
totalCharges : self::money(0),
7878
totalDiscounts: self::money(54.0),
@@ -104,8 +104,8 @@ private function initialSummary(): Summary
104104
{
105105
return Summary::is(
106106
quantity : 7,
107-
unitPrice : self::money(28.3898),
108-
subtotal : self::money(198.7286),
107+
unitPrice : self::money(36.0000),
108+
subtotal : self::money(252.0000),
109109
totalTaxes : self::money(53.2714),
110110
totalCharges : self::money(0),
111111
totaDiscounts: self::money(3.9746),

tests/Cashiers/Simple/InitialCalculationsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ public function test_initial_calculations_are_correct(): void
2222
$this->assertTotals(
2323
Summary::is(
2424
quantity : 10,
25-
unitPrice : self::money(82.6446),
26-
subtotal : self::money(826.4460),
25+
unitPrice : self::money(100.0000),
26+
subtotal : self::money(1000.0000),
2727
totalTaxes : self::money(173.5540),
2828
totalCharges : self::money(51.3220),
2929
totaDiscounts: self::money(21.5290),

0 commit comments

Comments
 (0)