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:
|
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
@@ -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;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user