/**
  *
  * @param UserModel $user
  * @param UserModel $admin
  * @param ProjectModel $projectModel
  * @param Website $website
  * @param DeliveryInterface $delivery
  */
 public static function sendJoinRequest($user, $admin, $projectModel, $website, DeliveryInterface $delivery = null)
 {
     $user->setValidation(7);
     $user->write();
     $to = array($admin->email => $admin->name);
     $subject = $user->name . ' join request';
     $vars = array('user' => $user, 'admin' => $admin, 'project' => $projectModel, 'link' => $website->baseUrl() . '/app/usermanagement/' . $projectModel->id->asString() . '#/joinRequests');
     self::sendTemplateEmail($to, $subject, 'JoinRequest', $vars, $website, $delivery);
 }
 /**
  * @expectedException Exception
  */
 public function testUpdateFromRegistration_ExpiredKey_UserNotUpdatedAndKeyConsumed()
 {
     self::$environ->clean();
     $user = new UserModel();
     $user->emailPending = '*****@*****.**';
     $key = $user->setValidation(1);
     $date = $user->validationExpirationDate;
     $date->sub(new DateInterval('P2D'));
     $user->validationExpirationDate = $date;
     $userId = $user->write();
     // save data for rest of this test
     self::$save['userId'] = $userId;
     $userArray = array('id' => '', 'username' => 'joe', 'name' => 'joe user', 'password' => 'password');
     self::$environ->inhibitErrorDisplay();
     UserCommands::updateFromRegistration($key, $userArray, self::$environ->website);
     // nothing runs in the current test function after an exception. IJH 2014-11
 }