Fixed weight integration, added testcase, fixed weird readme code example

This commit is contained in:
Patrick Henninger
2019-04-16 12:10:06 +02:00
parent 4d302fb4a2
commit 279e820760
3 changed files with 22 additions and 7 deletions

View File

@@ -1149,6 +1149,19 @@ class CartTest extends TestCase
$this->assertEquals(2.50, $cart->tax(2)); // tax of 5 Bucks
}
/** @test */
public function it_does_allow_adding_cart_items_with_weight_and_options()
{
// https://github.com/bumbummen99/LaravelShoppingcart/pull/5
$cart = $this->getCart();
$cartItem = $cart->add('293ad', 'Product 1', 1, 9.99, 550, ['size' => 'large']);
$this->assertEquals(550, $cartItem->weight);
$this->assertTrue($cartItem->options->has('size'));
$this->assertEquals('large', $cartItem->options->size);
}
/**
* Get an instance of the cart.
*