/** * @param Shipment $shipment * @param string $comment */ public function __construct(Shipment $shipment, $comment) { $this->setId(); $this->setCreated(); $this->comment = (string) $comment; $shipment->addShipmentComment($this); $this->setShipment($shipment); }
public function __construct(Shipment $shipment, OrderItem $orderItem, $quantityToShip) { $this->setId(); $this->setCreated(); $this->orderItem = $orderItem; $this->quantityToShip = (int) $quantityToShip; $shipment->addShipmentItem($this); $this->shipment = $shipment; }
public function testCreate() { $shipmentTracker = $this->dummyData->getShipmentTracker(); $shipment = new Shipment(); $shipment->addShipmentTracker($shipmentTracker); $order = $this->dummyData->getOrder(); $order->addShipment($shipment); $shipmentItem = $this->dummyData->getShipmentItem($shipment); $shipmentComment = $this->dummyData->getShipmentComment($shipment); $this->assertEntityValid($shipment); $this->assertSame($order, $shipment->getOrder()); $this->assertSame($shipmentTracker, $shipment->getShipmentTrackers()[0]); $this->assertSame($shipmentItem, $shipment->getShipmentItems()[0]); $this->assertSame($shipmentComment, $shipment->getShipmentComments()[0]); }
/** * @return static */ public function withOrder() { $this->entityDTO->order = $this->dtoBuilderFactory->getOrderDTOBuilder($this->entity->getOrder())->build(); return $this; }
public function isShipmentFullyShipped(Shipment $shipment) { $shipmentItem = $shipment->getShipmentItemForOrderItem($this); if ($shipmentItem === null) { return false; } if ($shipmentItem->getQuantityToShip() < $this->quantity) { return false; } return true; }
public function addShipment(Shipment $shipment) { $shipment->setOrder($this); $this->shipments->add($shipment); $this->setOrderShippedStatus(); $this->raise(new OrderShippedEvent($this->getId(), $shipment->getId())); }
private function assertOrderShippedEventIsDispatched(Order $order, Shipment $shipment) { /** @var OrderShippedEvent $event */ $event = $this->fakeEventDispatcher->getDispatchedEvents(OrderShippedEvent::class)[0]; $this->assertTrue($event instanceof OrderShippedEvent); $this->assertEquals($order->getId(), $event->getOrderId()); $this->assertSame($shipment->getId(), $event->getShipmentId()); }
public function setShipment(Shipment $shipment) { $this->shipment = $shipment; $shipment->addShipmentTracker($this); }