diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d5625b812..c0d721d49 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -32,7 +32,7 @@ jobs: - name: Check code formatting with PHP-CS-Fixer run: | rm composer.json composer.lock - composer require friendsofphp/php-cs-fixer + composer require friendsofphp/php-cs-fixer:3.4 vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist --diff --dry-run -v lint: diff --git a/src/Mealz/AccountingBundle/Tests/Controller/Payment/CashControllerTest.php b/src/Mealz/AccountingBundle/Tests/Controller/Payment/CashControllerTest.php index fb40afae9..354e6f056 100644 --- a/src/Mealz/AccountingBundle/Tests/Controller/Payment/CashControllerTest.php +++ b/src/Mealz/AccountingBundle/Tests/Controller/Payment/CashControllerTest.php @@ -91,7 +91,9 @@ function ($node, $i) { $transactionAmount += (float) trim(substr($transaction, 1, strpos($transaction, '€'))); } - $calculatedBalance = round($previousBalance - $participationAmount + $transactionAmount, 2); - $this->assertEquals($currentBalance, $calculatedBalance); + $assumedTotalAmount = $previousBalance - $participationAmount + $transactionAmount; + + $epsilon = 0.00001; + $this->assertTrue(abs($currentBalance - $assumedTotalAmount) < $epsilon); } } diff --git a/src/Mealz/AccountingBundle/Tests/Repository/TransactionRepositoryTest.php b/src/Mealz/AccountingBundle/Tests/Repository/TransactionRepositoryTest.php index 991855cf1..c125c3b9a 100644 --- a/src/Mealz/AccountingBundle/Tests/Repository/TransactionRepositoryTest.php +++ b/src/Mealz/AccountingBundle/Tests/Repository/TransactionRepositoryTest.php @@ -85,10 +85,11 @@ public function testTransactionsSummedUpByLastMonth(): void $usersTotalAmount = floatval($userData[$firstTransaction->getProfile()->getUsername()]['amount']); // calculate sum of amount for tempTransactions - $assumedTotalAmount = round($this->getAssumedTotalAmountForTransactionsFromLastMonth($tempTransactions), 2); + $assumedTotalAmount = $this->getAssumedTotalAmountForTransactionsFromLastMonth($tempTransactions); // compare both amounts - $this->assertEquals($usersTotalAmount, $assumedTotalAmount); + $epsilon = 0.00001; + $this->assertTrue(abs($usersTotalAmount - $assumedTotalAmount) < $epsilon); } /**