public function testCRUD() { $dto = new AccountDTO(); $dto->setName(self::NAME); $dto->setOwnerId(1); $this->service->create($dto); $this->assertEquals(self::ID, $dto->getId()); $this->assertEquals(self::NAME, $dto->getName()); $dto = $this->service->read(self::ID); $this->assertEquals(self::ID, $dto->getId()); $this->assertEquals(self::NAME, $dto->getName()); $dto->setName(self::NAME_ANOTHER); $dto = $this->service->update($dto); $dto = $this->service->read(self::ID); $this->assertEquals(self::ID, $dto->getId()); $this->assertEquals(self::NAME_ANOTHER, $dto->getName()); $this->service->delete(self::ID); $dto = $this->service->read(self::ID); $this->assertNull($dto->getId()); $this->assertNull($dto->getName()); }
public function entity(AccountDTO $dto, Account $entity) { $entity->setOwnerId($dto->getOwnerId()); $entity->setIdParent($dto->getIdParent()); $entity->setName($dto->getName()); }