/**
  * POST /order
  *
  * @param \Symfony\Component\HttpFoundation\Request $request
  *
  * @return \Symfony\Component\HttpFoundation\JsonResponse
  */
 public function createOrder(Request $request)
 {
     $postData = $request->request->all();
     unset($postData['id']);
     $order = Order::createFromArray($postData);
     $this->orderRepository->save($order);
     return new JsonResponse($order, 201);
 }
 /**
  * @test
  */
 public function insertAnOrder()
 {
     $orderData = ['status' => 'placed'];
     $this->db->expects(self::once())->method('insert')->with('order', $orderData);
     $this->db->expects(self::once())->method('lastInsertId')->willReturn(1);
     $order = new Order();
     $order->setStatus('placed');
     $this->repository->save($order);
     self::assertEquals(1, $order->getId());
 }