/**
  * @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_fill_backorder_units($stockable, $inventoryUnit1, $inventoryUnit2, $repository)
 {
     $stockable->getOnHand()->shouldBeCalled()->willReturn(1);
     $inventoryUnit1->setInventoryState(InventoryUnitInterface::STATE_SOLD)->shouldBeCalled();
     $inventoryUnit2->setInventoryState(InventoryUnitInterface::STATE_SOLD)->shouldNotBeCalled();
     $repository->findBy(ANY_ARGUMENTS)->willReturn(array($inventoryUnit1, $inventoryUnit2));
     $this->fillBackorders($stockable);
 }
 /**
  * @param Sylius\Bundle\InventoryBundle\Model\StockableInterface $stockable
  */
 function it_should_return_its_stockable_sku($stockable)
 {
     $stockable->getSku()->willReturn('IPHONE5');
     $this->setStockable($stockable);
     $this->getSku()->shouldReturn('IPHONE5');
 }
 /**
  * @param Sylius\Bundle\InventoryBundle\Model\StockableInterface $stockable
  */
 function it_should_recognize_stock_sufficient_if_its_available_on_demand_and_backorders_are_disabled($stockable)
 {
     $this->beConstructedWith(false);
     $stockable->isAvailableOnDemand()->willReturn(true);
     $stockable->getOnHand()->willReturn(0);
     $this->isStockSufficient($stockable, 999)->shouldReturn(true);
     $stockable->getOnHand()->willReturn(-5);
     $this->isStockSufficient($stockable, 3)->shouldReturn(true);
 }