generate() public static method

public static generate ( ) : OrderId
return OrderId
Esempio n. 1
0
 function test_placing_order_with_the_same_id_twice()
 {
     $this->expectException(OrderAlreadyExistsException::class);
     $cartId = $this->customerContext->createNewCartWithProducts('EUR', ['SKU_1', 'SKU_2']);
     $this->customerContext->checkout($cartId);
     $orderId = OrderId::generate();
     $placeOrderCommand = new PlaceOrder((string) $cartId, (string) $orderId);
     $this->customerContext->commandBus()->handle($placeOrderCommand);
     $this->customerContext->commandBus()->handle($placeOrderCommand);
 }
Esempio n. 2
0
 function it_creates_new_customer_service_order_when_customer_place_order(Orders $orders)
 {
     $orders->add(Argument::type(Order::class))->shouldBeCalled();
     $this->on(json_encode(['name' => Events::CUSTOMER_PLACED_ORDER, 'order_id' => (string) OrderId::generate(), 'date' => '2015-01-01 12:12:12']));
 }
Esempio n. 3
0
 function it_throws_exception_when_cart_is_empty(Products $products, Carts $carts)
 {
     $cart = new Cart(CartId::generate(), 'EUR');
     $carts->getById(Argument::type(CartId::class))->willReturn($cart);
     $this->shouldThrow(EmptyCartException::class)->during('placeOrder', [OrderId::generate(), $products, $carts]);
 }