/** * {@inheritdoc} */ public function isStockSufficient(StockableInterface $stockable, $quantity) { return !$stockable->isTracked() || $quantity <= $stockable->getOnHand() - $stockable->getOnHold(); }
function it_recognizes_stockable_as_available_or_sufficent_if_it_is_not_tracked(StockableInterface $stockable) { $stockable->isTracked()->willReturn(false); $this->isStockAvailable($stockable)->shouldReturn(true); $this->isStockSufficient($stockable, 42)->shouldReturn(true); }