Пример #1
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());
 }
Пример #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;
 }
Пример #3
0
 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;
 }
Пример #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);
 }
Пример #5
0
 /**
  * @testdox Allows to set the role name of a user
  * @covers Auth\Entity\User::getInfo
  * @covers Auth\Entity\User::setInfo
  * @dataProvider provideInfoTestData
  */
 public function testSetGetInfo($info, $expectedInfo)
 {
     $this->target->setInfo($info);
     $this->assertEquals($expectedInfo, $this->target->getInfo());
 }