public function testAddShipmentChangesOrderStatusToPartiallyShipped() { $orderItem = $this->dummyData->getOrderItem(); $orderItem->setQuantity(2); $shipment = $this->dummyData->getShipment(); $this->dummyData->getShipmentItem($shipment, $orderItem, 1); $order = new Order(); $order->addOrderItem($orderItem); $this->assertFalse($order->getStatus()->isPartiallyShipped()); $order->addShipment($shipment); $this->assertTrue($order->getStatus()->isPartiallyShipped()); }
/** * @param string $comment * @param \inklabs\kommerce\EntityDTO\OrderItemQtyDTO $orderItemQtyDTO * @param ShipmentTracker $shipmentTracker * @param Order $order */ private function addShipment($comment, OrderItemQtyDTO $orderItemQtyDTO, ShipmentTracker $shipmentTracker, Order $order) { $shipment = new Shipment(); $shipmentTracker->setShipment($shipment); if ($comment !== '') { new ShipmentComment($shipment, $comment); } $this->addShipmentItemsFromOrderItems($orderItemQtyDTO, $shipment); $order->addShipment($shipment); $this->update($order); }