public function __construct(User $user, DTOBuilderFactoryInterface $dtoBuilderFactory) { $this->entity = $user; $this->dtoBuilderFactory = $dtoBuilderFactory; $this->entityDTO = $this->getEntityDTO(); $this->setId(); $this->setTime(); $this->entityDTO->externalId = $this->entity->getExternalId(); $this->entityDTO->email = $this->entity->getEmail(); $this->entityDTO->firstName = $this->entity->getFirstName(); $this->entityDTO->lastName = $this->entity->getLastName(); $this->entityDTO->totalLogins = $this->entity->getTotalLogins(); $this->entityDTO->lastLogin = $this->entity->getLastLogin(); $this->entityDTO->status = $this->dtoBuilderFactory->getUserStatusTypeDTOBuilder($this->entity->getStatus())->build(); }
public function testIncrementTotalLogins() { $user = new User(); $this->assertSame(null, $user->getLastLogin()); $user->incrementTotalLogins(); $this->assertSame(1, $user->getTotalLogins()); $this->assertTrue($user->getLastLogin()->getTimestamp() > 0); }