/**
  * @param Sylius\Bundle\InventoryBundle\Model\StockableInterface     $stockable
  * @param Sylius\Bundle\InventoryBundle\Model\InventoryUnitInterface $inventoryUnit1
  * @param Sylius\Bundle\InventoryBundle\Model\InventoryUnitInterface $inventoryUnit2
  * @param Doctrine\Common\Persistence\ObjectRepository               $repository
  */
 function it_should_backorder_units_if_quantity_is_greater_then_on_hand($stockable, $inventoryUnit1, $inventoryUnit2, $repository)
 {
     $stockable->getOnHand()->shouldBeCalled()->willReturn(1);
     $stockable->setOnHand(0)->shouldBeCalled();
     $inventoryUnit1->setStockable($stockable)->shouldBeCalled();
     $inventoryUnit1->setInventoryState(InventoryUnitInterface::STATE_SOLD)->shouldBeCalled();
     $repository->createNew()->willReturn($inventoryUnit1);
     $inventoryUnit2->setStockable($stockable)->shouldBeCalled();
     $inventoryUnit2->setInventoryState(InventoryUnitInterface::STATE_SOLD)->shouldBeCalled();
     $inventoryUnit2->setInventoryState(InventoryUnitInterface::STATE_BACKORDERED)->shouldBeCalled();
     $repository->createNew()->willReturn($inventoryUnit2);
     $this->decrease($stockable, 2)->shouldHaveType('Doctrine\\Common\\Collections\\ArrayCollection');
 }