From d4b5f13b0f6f5618c26b38cdc8a6db282202e593 Mon Sep 17 00:00:00 2001 From: Michiel Gerritsen Date: Thu, 11 Apr 2024 16:08:45 +0200 Subject: [PATCH] Bugfix: Add adjustment when the difference is rounded 0.01 cents --- Service/Order/Lines/Order.php | 4 ++-- Test/Integration/Service/Order/Lines/OrderTest.php | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Service/Order/Lines/Order.php b/Service/Order/Lines/Order.php index 592949fb22e..ec28e4646be 100644 --- a/Service/Order/Lines/Order.php +++ b/Service/Order/Lines/Order.php @@ -1,5 +1,5 @@ assertEquals('discount', $lastLine['type']); - $this->assertEquals($adjustment, $lastLine['totalAmount']['value']); + $this->assertEquals(round($adjustment, 2), $lastLine['totalAmount']['value']); $total = 0; foreach ($result as $orderLine) { $total += $orderLine['totalAmount']['value']; } - $this->assertEquals($order->getBaseGrandTotal(), $total); + $this->assertEquals( + round($order->getBaseGrandTotal(), 2), + $total + ); } /** @@ -242,6 +245,8 @@ public function adjustmentsDataProvider(): array [-0.03], [-0.02], [-0.01], + [0.0051111111], // Rounds up to 0.1, so valid + [0.0099999999], // Rounds up to 0.1, so valid [0.01], [0.02], [0.03],