public function __construct(ShipmentTracker $shipmentTracker, DTOBuilderFactoryInterface $dtoBuilderFactory) { $this->entity = $shipmentTracker; $this->dtoBuilderFactory = $dtoBuilderFactory; $this->entityDTO = new ShipmentTrackerDTO(); $this->setId(); $this->setTime(); $this->entityDTO->trackingCode = $this->entity->getTrackingCode(); $this->entityDTO->externalId = $this->entity->getExternalId(); $this->entityDTO->carrier = $this->dtoBuilderFactory->getShipmentCarrierTypeDTOBuilder($this->entity->getCarrier())->build(); if ($this->entity->getShipmentRate() !== null) { $this->entityDTO->shipmentRate = $this->dtoBuilderFactory->getShipmentRateDTOBuilder($this->entity->getShipmentRate())->build(); } if ($this->entity->getShipmentLabel() !== null) { $this->entityDTO->shipmentLabel = $this->dtoBuilderFactory->getShipmentLabelDTOBuilder($this->entity->getShipmentLabel())->build(); } }
public function testCreateDefaults() { $shipmentTracking = new ShipmentTracker($this->dummyData->getShipmentCarrierType(), '1Z9999999999999999'); $this->assertSame(null, $shipmentTracking->getShipmentRate()); $this->assertSame(null, $shipmentTracking->getShipmentLabel()); }