mirror of
https://github.com/wearepixel/laravel-cart.git
synced 2026-11-14 22:01:48 +00:00
wip: fix issue with conditions not being properly removed
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "wearepixel/laravel-cart",
|
"name": "wearepixel/laravel-cart",
|
||||||
"version": "1.0.9",
|
"version": "1.0.10",
|
||||||
"description": "A cart implementation for Laravel",
|
"description": "A cart implementation for Laravel",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"laravel",
|
"laravel",
|
||||||
|
|||||||
+1
-4
@@ -406,9 +406,6 @@ public function removeCartCondition($conditionName)
|
|||||||
|
|
||||||
$conditions->pull($conditionName);
|
$conditions->pull($conditionName);
|
||||||
|
|
||||||
// reset indexes
|
|
||||||
$conditions = $conditions->values();
|
|
||||||
|
|
||||||
$this->saveConditions($conditions);
|
$this->saveConditions($conditions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -736,7 +733,7 @@ protected function addItem($id, $item)
|
|||||||
/**
|
/**
|
||||||
* save the cart
|
* save the cart
|
||||||
*
|
*
|
||||||
* @param $cart CartCollection
|
* @param $cart CartCollection
|
||||||
*/
|
*/
|
||||||
protected function save($cart)
|
protected function save($cart)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,11 +10,11 @@
|
|||||||
$events->shouldReceive('dispatch');
|
$events->shouldReceive('dispatch');
|
||||||
|
|
||||||
$this->cart = new Cart(
|
$this->cart = new Cart(
|
||||||
new SessionMock,
|
new SessionMock(),
|
||||||
$events,
|
$events,
|
||||||
'cart',
|
'cart',
|
||||||
'SAMPLESESSIONKEY',
|
'SAMPLESESSIONKEY',
|
||||||
require (__DIR__ . '/../Helpers/ConfigConditionsMock.php')
|
require(__DIR__ . '/../Helpers/ConfigConditionsMock.php')
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -119,7 +119,7 @@
|
|||||||
|
|
||||||
// now we should have only 1 condition left on that item
|
// now we should have only 1 condition left on that item
|
||||||
expect($this->cart->getConditions())->toHaveCount(1, 'Item should have one condition left');
|
expect($this->cart->getConditions())->toHaveCount(1, 'Item should have one condition left');
|
||||||
expect($this->cart->getConditions()[0]->getName())->toEqual('Mother\'s Day Gift Pack');
|
expect($this->cart->getConditions()->first()->getName())->toEqual('Mother\'s Day Gift Pack');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user