Example #1
0
 /**
  * @testdox Allows setting the users city
  * @covers Auth\Entity\Info::getLastName
  * @covers Auth\Entity\Info::setLastName
  * @dataProvider provideGetDisplayNameTestData
  */
 public function testGetDisplayName($firstname, $lastname, $email, $result)
 {
     $this->target->setFirstName($firstname);
     $this->target->setLastName($lastname);
     $this->target->setEmail($email);
     $this->assertEquals($result, $this->target->getDisplayName());
 }
Example #2
0
 /**
  * @param array $params
  *
  * @return User
  */
 public static function createEntityWithRandomData(array $params = array())
 {
     $withId = true;
     $entityId = bin2hex(substr(uniqid(), 1));
     $email = uniqid('email');
     $login = uniqid('login');
     $password = uniqid('password');
     $role = User::ROLE_RECRUITER;
     extract($params);
     $userEntity = new User();
     $userEntity->setEmail($email)->setLogin($login)->setPassword($password)->setRole($role);
     $infoEntity = new Info();
     $infoEntity->setEmail($email);
     $userEntity->setInfo($infoEntity);
     if ($withId) {
         $userEntity->setId($entityId);
     }
     $organization = new OrganizationReferenceMock();
     $userEntity->setOrganization($organization);
     return $userEntity;
 }
 protected function createUser($role = User::ROLE_RECRUITER)
 {
     $email = '*****@*****.**';
     $locator = $this->getApplicationServiceLocator();
     /* @var DocumentManager $dm */
     $dm = $locator->get('doctrine.documentmanager.odm_default');
     $userRepo = $dm->getRepository('Auth\\Entity\\User');
     $user = $userRepo->findOneBy(array('login' => $email));
     if (empty($user)) {
         $user = new User();
         $user->setEmail($email)->setLogin($email)->setRole($role)->setPassword($email);
         $infoEntity = new Info();
         $infoEntity->setEmail($email);
         $user->setInfo($infoEntity);
         $dm->persist($user);
     } else {
         $user->setRole($role);
     }
     $dm->flush();
     $this->activeUser = $user;
     return $user;
 }
Example #4
0
 public function testSetGetContactEmailWithUser()
 {
     $input = "*****@*****.**";
     $info = new Info();
     $info->setEmail($input);
     $user = new User();
     $user->setInfo($info);
     $this->target->setUser($user);
     $this->assertEquals($this->target->getContactEmail(), $input);
 }
Example #5
0
 /**
  * @testdox Allows to set the role name of a user
  * @covers Auth\Entity\User::getEmail
  * @covers Auth\Entity\User::setEmail
  * @dataProvider provideEmailTestData
  */
 public function testSetGetEmail($userEmail, $infoEmail, $expectedEmail)
 {
     $info = new Info();
     $info->setEmail($infoEmail);
     $this->target->setInfo($info);
     $this->target->setEmail($userEmail);
     $this->assertEquals($expectedEmail, $this->target->getEmail());
 }