コード例 #1
0
 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));
     }
 }
コード例 #2
0
ファイル: User.php プロジェクト: inklabs/kommerce-core
 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());
 }
コード例 #3
0
 protected function preBuild()
 {
     $this->entityDTO->isInactive = $this->entity->isInactive();
     $this->entityDTO->isActive = $this->entity->isActive();
     $this->entityDTO->isLocked = $this->entity->isLocked();
 }
コード例 #4
0
ファイル: DummyData.php プロジェクト: inklabs/kommerce-core
 public function getUserStatusType()
 {
     return UserStatusType::inactive();
 }
コード例 #5
0
 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);
 }
コード例 #6
0
 public function testCreateByIdThrowsExceptionWhenInvalid()
 {
     $this->setExpectedException(InvalidArgumentException::class);
     UserStatusType::createById(999);
 }