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();
 }
Exemple #2
0
 public function testCreateDefaults()
 {
     $user = new User();
     $this->assertTrue($user->getId() instanceof UuidInterface);
     $this->assertTrue($user->getCreated() instanceof DateTime);
     $this->assertTrue($user->getStatus()->isActive());
     $this->assertSame(null, $user->getExternalId());
     $this->assertSame(null, $user->getEmail());
     $this->assertSame(null, $user->getFirstName());
     $this->assertSame(null, $user->getLastName());
     $this->assertSame(null, $user->getCart());
     $this->assertSame(null, $user->getLastLogin());
     $this->assertSame(0, $user->getTotalLogins());
     $this->assertSame(0, count($user->getUserRoles()));
     $this->assertSame(0, count($user->getUserTokens()));
     $this->assertSame(0, count($user->getUserLogins()));
     $this->assertSame(0, count($user->getOrders()));
 }