public function testCreateDTO() { $movement = new Movement(); $movement->setDate(new \DateTime()); $movement->setAmount(new Money(10)); $movement->setName(new SmallString('Testing DTO')); $movement->setDescription(new Text('Description of DTO')); $expected = new \stdClass(); $expected->id = null; $expected->date = $movement->getDate()->format('Y-m-d H:i:s'); $expected->amount = 10; $expected->name = 'Testing DTO'; $expected->description = 'Description of DTO'; $result = $this->repository->createDTO($movement); $this->assertEquals($expected, $result); }
public function createDTO(\InFog\SimpleFinance\Entities\Movement $movement) { $dto = new \stdClass(); $dto->id = $movement->getId(); $dto->date = $movement->getDate()->format('Y-m-d H:i:s'); $dto->amount = $movement->getAmount()->getValue(); $dto->name = $movement->getName()->getValue(); $dto->description = $movement->getDescription()->getValue(); return $dto; }