/** @test */ public function we_can_add_multiple_custom_attributes_at_once_to_an_order() { $this->createCartAndClient(); $order = Order::create(["ref" => "123"]); $order->setMultipleCustomAttribute(["custom" => "value", "custom2" => "value2"]); $this->assertEquals("value", $order->customAttribute("custom")); $this->assertEquals("value2", $order->customAttribute("custom2")); $this->seeInDatabase('merx_orders', ["id" => $order->id, "custom_attributes" => json_encode(["custom" => "value", "custom2" => "value2"])]); }
/** @test */ public function we_cant_add_an_item_on_a_closed_cart() { $cart = Cart::create(); $cart->addItem(new CartItem($this->itemAttributes())); $client = $this->loginClient(); Order::create(["cart_id" => $cart->id, "client_id" => $client->id, "ref" => "123"])->update(["state" => "completed"]); $cart = $cart->fresh(); $this->setExpectedException(CartClosedException::class); $cart->addItem(new CartItem($this->itemAttributes())); }