Example #1
0
 /**
  * Sends mail
  *
  * @param UserRegistrationInterface $registrationRecord
  * @param string $subject
  * @param string $template
  */
 protected function sendMail(UserRegistrationInterface $registrationRecord, $subject, $template)
 {
     $user = $registrationRecord->getUser();
     $message = $this->mailService->compose(['to' => $user->getEmail()], $template, ['user' => $user, 'registrationRecord' => $registrationRecord]);
     $fromEmail = $this->options->getEmailFromAddress();
     if ($fromEmail) {
         $message->setFrom($fromEmail);
     }
     $message->setSubject($subject);
     return $this->mailService->send($message);
 }
 public function testSettersAndGetters()
 {
     $options = new ModuleOptions(['emailFromAddress' => '*****@*****.**', 'verification_email_template' => 'application/mail/verify-email.phtml', 'password_request_email_template' => 'application/mail/set-password.phtml', 'enable_request_expiry' => true, 'request_expiry' => 1000000, 'registration_table_name' => 'user_registration123', 'registration_entity_class' => 'Application\\Entity\\UserRegistration', 'send_verification_email' => false, 'send_password_request_email' => false, 'verification_email_subject' => 'Your Email Address Verification', 'password_request_email_subject' => 'Please Set Your Password', 'post_verification_route' => 'zfcuser']);
     $this->assertEquals('*****@*****.**', $options->getEmailFromAddress());
     $this->assertEquals('application/mail/verify-email.phtml', $options->getVerificationEmailTemplate());
     $this->assertEquals('application/mail/set-password.phtml', $options->getPasswordRequestEmailTemplate());
     $this->assertEquals(true, $options->getEnableRequestExpiry());
     $this->assertEquals(1000000, $options->getRequestExpiry());
     $this->assertEquals('user_registration123', $options->getRegistrationTableName());
     $this->assertEquals('Application\\Entity\\UserRegistration', $options->getRegistrationEntityClass());
     $this->assertEquals(false, $options->getSendVerificationEmail());
     $this->assertEquals(false, $options->getSendPasswordRequestEmail());
     $this->assertEquals('Your Email Address Verification', $options->getVerificationEmailSubject());
     $this->assertEquals('Please Set Your Password', $options->getPasswordRequestEmailSubject());
     $this->assertEquals('zfcuser', $options->getPostVerificationRoute());
 }