public function __construct(InventoryTransaction $inventoryTransaction, DTOBuilderFactoryInterface $dtoBuilderFactory) { $this->entity = $inventoryTransaction; $this->dtoBuilderFactory = $dtoBuilderFactory; $this->entityDTO = new InventoryTransactionDTO(); $this->setId(); $this->setTime(); $this->entityDTO->debitQuantity = $this->entity->getDebitQuantity(); $this->entityDTO->creditQuantity = $this->entity->getCreditQuantity(); $this->entityDTO->memo = $this->entity->getMemo(); $this->entityDTO->type = $this->dtoBuilderFactory->getInventoryTransactionTypeDTOBuilder($this->entity->getType())->build(); $this->entityDTO->inventoryLocation = $this->dtoBuilderFactory->getInventoryLocationDTOBuilder($this->entity->getInventoryLocation())->build(); }
public function testCreateDefaults() { $inventoryTransaction = new InventoryTransaction(); $this->assertSame(null, $inventoryTransaction->getInventoryLocation()); $this->assertSame(null, $inventoryTransaction->getProduct()); $this->assertSame(null, $inventoryTransaction->getDebitQuantity()); $this->assertSame(null, $inventoryTransaction->getCreditQuantity()); $this->assertSame(null, $inventoryTransaction->getMemo()); $this->assertTrue($inventoryTransaction->getType()->isMove()); }