public function testOrderMarkedAsShippedWhen2PartialShipmentsAreFullyShipped() { $order1 = $this->getPersistedOrderWith2Items(); $orderItem1 = $order1->getOrderItems()[0]; $orderItem2 = $order1->getOrderItems()[1]; $carrierType = $this->dummyData->getShipmentCarrierType(); $orderItemQtyDTO = new OrderItemQtyDTO(); $orderItemQtyDTO->addOrderItemQty($orderItem1->getId(), 1); $this->orderService->addShipmentTrackingCode($order1->getId(), $orderItemQtyDTO, '1 of 2 items shipped', $carrierType->getId(), 'XXXX'); $this->assertSame(1, count($order1->getShipments())); $this->assertTrue($order1->getStatus()->isPartiallyShipped()); $orderItemQtyDTO = new OrderItemQtyDTO(); $orderItemQtyDTO->addOrderItemQty($orderItem2->getId(), 1); $this->orderService->addShipmentTrackingCode($order1->getId(), $orderItemQtyDTO, '2 of 2 items shipped. This completes your order', $carrierType->getId(), 'XXXX'); $this->assertSame(2, count($order1->getShipments())); $this->assertTrue($order1->getStatus()->isShipped()); }
public function handle(AddShipmentTrackingCodeCommand $command) { $this->orderService->addShipmentTrackingCode($command->getOrderId(), $command->getOrderItemQtyDTO(), $command->getComment(), $command->getCarrier(), $command->getTrackingCode()); }