From a464a240e8f0337f6f1f4a6e11a80ea4dbb118f2 Mon Sep 17 00:00:00 2001 From: Patrick Date: Wed, 26 Jun 2019 15:36:53 +0200 Subject: [PATCH] Update CartTest.php Added Test for CartItem.php invalid weight exception. --- tests/CartTest.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/CartTest.php b/tests/CartTest.php index 8c278e5..611ae37 100644 --- a/tests/CartTest.php +++ b/tests/CartTest.php @@ -263,6 +263,19 @@ class CartTest extends TestCase $cart->add(1, 'Some title', 1, 'invalid'); } + + /** + * @test + */ + public function it_will_validate_the_weight() + { + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('Please supply a valid weight'); + + $cart = $this->getCart(); + + $cart->add(1, 'Some title', 1, 10.00, 'invalid'); + } /** @test */ public function it_will_update_the_cart_if_the_item_already_exists_in_the_cart()