/**
  *
  * @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);
 }
 public function testUpdateFromRegistration_ExpiredKey_UserNotUpdatedAndKeyConsumed()
 {
     $this->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
     $this->save['userId'] = $userId;
     $userArray = array('id' => '', 'username' => 'joe', 'name' => 'joe user', 'password' => 'password');
     $this->environ->inhibitErrorDisplay();
     $this->expectException();
     UserCommands::updateFromRegistration($key, $userArray, $this->environ->website);
     // nothing runs in the current test function after an exception. IJH 2014-11
 }