Skip to content

Commit

Permalink
Add test that adding same product only increment amount
Browse files Browse the repository at this point in the history
  • Loading branch information
simara-svatopluk committed Dec 17, 2017
1 parent a7de3c2 commit e8135a0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/Domain/CartTest.php
Expand Up @@ -42,4 +42,16 @@ public function testAddTwoDifferentProducts()

Assert::assertEquals($expected, $cart->calculate());
}

public function testAddSameProductIncrementAmountOnly()
{
$cart = new Cart();
$cart->add('a', new Price(10.0));
$cart->add('a', new Price(0.0));

$expectedItem = new DetailItem('a', new Price(10.0), 2);
$expected = new CartDetail([$expectedItem], new Price(20.0));

Assert::assertEquals($expected, $cart->calculate());
}
}

0 comments on commit e8135a0

Please sign in to comment.