Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

カート内数量減算を連続クリックしても、カートから商品が削除されないように変更 #1268 #2091

Merged
merged 3 commits into from
Feb 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/Eccube/Service/CartService.php
Original file line number Diff line number Diff line change
Expand Up @@ -508,11 +508,8 @@ public function upProductQuantity($productClassId)
public function downProductQuantity($productClassId)
{
$quantity = $this->getProductQuantity($productClassId) - 1;

if ($quantity > 0) {
$this->setProductQuantity($productClassId, $quantity);
} else {
$this->removeProduct($productClassId);
}

return $this;
Expand Down
6 changes: 3 additions & 3 deletions tests/Eccube/Tests/Service/CartServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,16 +145,16 @@ public function testDownProductQuantity()
$this->assertEquals(1, $quantity);
}

public function testDownProductQuantity_Remove()
public function testDownProductQuantity_NotRemove()
{
$cartService = $this->app['eccube.service.cart'];

$cartService->setProductQuantity(1, 1);
$cartService->downProductQuantity(1);

$quantity = $cartService->getProductQuantity(1);
$this->assertEquals(0, $quantity);
$this->assertCount(0, $cartService->getCart()->getCartItems());
$this->assertEquals(1, $quantity);
$this->assertCount(1, $cartService->getCart()->getCartItems());
}

public function testRemoveProduct()
Expand Down