/**
  * @expectedException HealthCareAbroad\UserBundle\Services\Exception\FailedAccountRequestException
  */
 public function testCreateWithMissingFields()
 {
     $institution = $this->getDoctrine()->getRepository('InstitutionBundle:Institution')->find(1);
     $institutionUserType = $this->getDoctrine()->getRepository('UserBundle:InstitutionUserType')->find(1);
     $user = new InstitutionUser();
     $user->setEmail(null);
     $user->setPassword($this->commonPassword);
     $user->setFirstName('');
     $user->setMiddleName('');
     $user->setLastName('User');
     $user->setInstitution($institution);
     $user->setInstitutionUserType($institutionUserType);
     $user->setStatus(SiteUser::STATUS_ACTIVE);
     $user = $this->service->create($user);
     return $user;
 }
 public function testSendInstitutionUserLoginCredentials()
 {
     // create temporary 10 character password
     $temporaryPassword = \substr(SecurityHelper::hash_sha256(time()), 0, 10);
     // get data for institution
     $institution = $this->doctrine->getRepository('InstitutionBundle:Institution')->find(1);
     //get data for institutionUserType
     $institutionUserType = $this->doctrine->getRepository('UserBundle:InstitutionUserType')->find(1);
     $user = new InstitutionUser();
     $user->setInstitution($institution);
     $user->setInstitutionUserType($institutionUserType);
     $user->setEmail('*****@*****.**');
     $user->setPassword($temporaryPassword);
     $user->setFirstName('alnie');
     $user->setMiddleName('leones');
     $user->setLastName('jacobe');
     $user->setStatus('1');
     $sendingResult = $this->service->sendInstitutionUserLoginCredentials($user, $temporaryPassword);
     $this->assertEquals(1, $sendingResult);
     return $sendingResult;
 }
 public function createInstitutionUser(InstitutionUserType $institutionUserType, InstitutionUser $institutionUser)
 {
     $institutionUser->setInstitutionUserType($institutionUserType);
     $institutionUser = $this->institutionUserService->create($institutionUser);
 }