public function test_key_is_set_upon_creation() { $cart = new Cart(); $cart->save(); $this->assertInternalType('string', $cart->key); $this->assertGreaterThan(0, strlen($cart->key)); }
/** * Save the cart and update the user's session * * @return void */ public function saveCart() { $this->cart->save(); if (!$this->getSession()) { Session::put(self::CART_KEY, ['id' => $this->cart->id, 'key' => $this->cart->key]); } }