Compare commits

...
1 Commits
Author SHA1 Message Date
Joel Male 472d505041 wip: fix issue with conditions not being properly removed 2024-09-18 15:56:12 +10:00
3 changed files with 5 additions and 8 deletions
+1 -1
View File
@@ -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",
-3
View File
@@ -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);
} }
+2 -2
View File
@@ -10,7 +10,7 @@
$events->shouldReceive('dispatch'); $events->shouldReceive('dispatch');
$this->cart = new Cart( $this->cart = new Cart(
new SessionMock, new SessionMock(),
$events, $events,
'cart', 'cart',
'SAMPLESESSIONKEY', 'SAMPLESESSIONKEY',
@@ -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');
}); });
}); });