mirror of
https://github.com/kevin-DL/LaravelShoppingcart.git
synced 2026-01-11 18:54:33 +00:00
Add a test case to assert items sequence is kept if the options changed
This commit is contained in:
@@ -399,6 +399,21 @@ class CartTest extends TestCase
|
||||
$this->assertRowsInCart(1, $cart);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_will_keep_items_sequence_if_the_options_changed()
|
||||
{
|
||||
$cart = $this->getCart();
|
||||
|
||||
$cart->add(new BuyableProduct(), 1, ['color' => 'red']);
|
||||
$cart->add(new BuyableProduct(), 1, ['color' => 'green']);
|
||||
$cart->add(new BuyableProduct(), 1, ['color' => 'blue']);
|
||||
|
||||
$cart->update($cart->content()->values()[1]->rowId, ['options' => ['color' => 'yellow']]);
|
||||
|
||||
$this->assertRowsInCart(3, $cart);
|
||||
$this->assertEquals('yellow', $cart->content()->values()[1]->options->color);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_can_remove_an_item_from_the_cart()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user