public function customersHavePlacedOrdersForTotalOf($numberOfCustomers, $numberOfOrders, $total)
{
$customers = $this->generateCustomers($numberOfCustomers);
$sampleProductVariant = $this->sharedStorage->get('variant');
$total = $this->getPriceFromString($total);
for ($i = 0; $i < $numberOfOrders; $i++) {
$order = $this->createOrder($customers[rand(0, $numberOfCustomers - 1)], '#' . uniqid());
$order->setState(OrderInterface::STATE_NEW);
// Temporary, we should use checkout to place these orders.
$this->applyPaymentTransitionOnOrder($order, PaymentTransitions::TRANSITION_COMPLETE);
$price = $i === $numberOfOrders - 1 ? $total : rand(1, $total);
$total -= $price;
$item = $this->orderItemFactory->createNew();
$item->setVariant($sampleProductVariant);
$item->setUnitPrice($price);
$this->itemQuantityModifier->modify($item, 1);
$order->addItem($item);
$this->orderRepository->add($order);
$this->sharedStorage->set('order', $order);
}
}