public static function setFromDTO(User &$user, UserDTO $userDTO) { $user->setExternalId($userDTO->externalId); $user->setEmail($userDTO->email); $user->setFirstName($userDTO->firstName); $user->setLastName($userDTO->lastName); if ($userDTO->status !== null) { $user->setStatus(UserStatusType::createById($userDTO->status->id)); } }
public function __construct(UuidInterface $id = null) { $this->setId($id); $this->setCreated(); $this->userRoles = new ArrayCollection(); $this->userTokens = new ArrayCollection(); $this->userLogins = new ArrayCollection(); $this->orders = new ArrayCollection(); $this->totalLogins = 0; $this->lastLogin = null; $this->setStatus(UserStatusType::active()); }
protected function preBuild() { $this->entityDTO->isInactive = $this->entity->isInactive(); $this->entityDTO->isActive = $this->entity->isActive(); $this->entityDTO->isLocked = $this->entity->isLocked(); }
public function getUserStatusType() { return UserStatusType::inactive(); }
public function testLoginWithTokenThrowsExceptionWhenUserNotActive() { $user1 = $this->dummyData->getUser(); $user1->setStatus(UserStatusType::inactive()); $this->userRepository->shouldReceive('findOneByEmail')->andReturn($user1)->once(); $this->userLoginRepository->shouldReceive('create')->once(); $this->setExpectedException(UserLoginException::class, 'User not active'); $this->userService->loginWithToken($user1->getEmail(), 'token123', self::IP4); }
public function testCreateByIdThrowsExceptionWhenInvalid() { $this->setExpectedException(InvalidArgumentException::class); UserStatusType::createById(999); }