mirror of
https://github.com/wearepixel/laravel-cart.git
synced 2026-11-14 22:01:48 +00:00
fix tests for cart conditions
This commit is contained in:
@@ -13,7 +13,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
php: ['8.1','8.2', '8.3']
|
||||
php: ['8.0', '8.1','8.2', '8.3', '8.4']
|
||||
stability: [prefer-stable]
|
||||
|
||||
steps:
|
||||
|
||||
+4
-8
@@ -345,17 +345,13 @@ public function getConditions(bool $active = false): CartConditionCollection
|
||||
|
||||
if ($active) {
|
||||
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() <= $amount;
|
||||
return $condition->getMinimum() === null || $condition->getMinimum() <= $amount;
|
||||
})->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() >= $amount;
|
||||
return $condition->getMaximum() === null || $condition->getMaximum() >= $amount;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user