function it_can_be_used_to_place_order(Products $products, Carts $carts) { $product = new Product(new SKU("SKU"), Price::EUR(1000), true); $cart = new Cart(CartId::generate(), 'EUR'); $cart->add($product, 1); $carts->getById(Argument::type(CartId::class))->willReturn($cart); $products->getBySku(Argument::type(SKU::class))->willReturn($product); $order = $this->placeOrder(OrderId::generate(), $products, $carts); $order->shouldBeAnInstanceOf(Order::class); }
/** * @param Cart $cart */ public function add(Cart $cart) { $this->carts[(string) $cart->id()] = $cart; }