fix tests for cart conditions

This commit is contained in:
Joel Male
2024-09-03 21:07:58 +10:00
parent a269c188e4
commit 4d2efcdeae
2 changed files with 5 additions and 9 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ jobs:
strategy: strategy:
fail-fast: true fail-fast: true
matrix: matrix:
php: ['8.1','8.2', '8.3'] php: ['8.0', '8.1','8.2', '8.3', '8.4']
stability: [prefer-stable] stability: [prefer-stable]
steps: steps:
+4 -8
View File
@@ -345,17 +345,13 @@ public function getConditions(bool $active = false): CartConditionCollection
if ($active) { if ($active) {
return $conditions->filter(function (CartCondition $condition) { return $conditions->filter(function (CartCondition $condition) {
$target = $condition->getTarget(); $amount = $condition->getTarget() == 'subtotal' ? $this->getSubTotal(false) : $this->getTotal();
$amount = $target == 'subtotal' ? $this->getSubTotal(false) : $this->getTotal(); return $condition->getMinimum() === null || $condition->getMinimum() <= $amount;
return $condition->getMinimum() <= $amount;
})->filter(function (CartCondition $condition) { })->filter(function (CartCondition $condition) {
$target = $condition->getTarget(); $amount = $condition->getTarget() == 'subtotal' ? $this->getSubTotal(false) : $this->getTotal();
$amount = $target == 'subtotal' ? $this->getSubTotal(false) : $this->getTotal(); return $condition->getMaximum() === null || $condition->getMaximum() >= $amount;
return $condition->getMaximum() >= $amount;
}); });
} }