function it_adds_new_item_units_to_existing_shipment(OrderInterface $order, ShipmentInterface $shipment, ArrayCollection $shipments, OrderItemUnitInterface $itemUnit, OrderItemUnitInterface $itemUnitWithoutShipment) { $shipments->first()->willReturn($shipment)->shouldBeCalled(); $order->hasShipments()->willReturn(true)->shouldBeCalled(); $itemUnit->getShipment()->willReturn($shipment); $order->getItemUnits()->willReturn([$itemUnit, $itemUnitWithoutShipment]); $order->getShipments()->willReturn($shipments)->shouldBeCalled(); $shipment->addUnit($itemUnitWithoutShipment)->shouldBeCalled(); $shipment->addUnit($itemUnit)->shouldNotBeCalled(); $this->createForOrder($order); }