function it_does_nothing_if_target_quantity_is_below_0($orderItemUnitFactory, OrderItemInterface $orderItem) { $orderItem->getQuantity()->willReturn(3); $orderItemUnitFactory->createForItem(Argument::any())->shouldNotBeCalled(); $orderItem->addUnit(Argument::any())->shouldNotBeCalled(); $orderItem->removeUnit(Argument::any())->shouldNotBeCalled(); $this->modify($orderItem, -10); }
function let(OrderItemInterface $orderItem) { $orderItem->getUnitPrice()->willReturn(1000); $orderItem->addUnit(Argument::type(OrderItemUnitInterface::class))->shouldBeCalled(); $this->beConstructedWith($orderItem); }
/** * @param OrderItemInterface $orderItem */ public function __construct(OrderItemInterface $orderItem) { $this->orderItem = $orderItem; $this->orderItem->addUnit($this); $this->adjustments = new ArrayCollection(); }