public function sendVerificationEmailMessage(Model $record)
 {
     $fromAddress = $this->getEmailMessageOptions()->getEmailFromAddress();
     $subject = $this->getEmailMessageOptions()->getVerificationEmailSubjectLine();
     $message = new EmailMessage();
     $message->setFrom($fromAddress);
     $message->setTo($record->getEmailAddress());
     $message->setSubject($subject);
     $viewModel = new ViewModel(array('record' => $record));
     $viewModel->setTerminal(true)->setTemplate('cdli-twostagesignup/email/verification');
     $message->setBody($this->emailRenderer->render($viewModel));
     $this->emailTransport->send($message);
 }
 public function testCreateFromForm()
 {
     $model = new Entity();
     $model->setEmailAddress('*****@*****.**');
     $form = $this->getMock('Zend\\Form\\Form');
     $form->expects($this->any())->method('getData')->will($this->returnValue($model));
     $form->expects($this->any())->method('isValid')->will($this->returnValue(true));
     $evrMapper = $this->getMock('CdliTwoStageSignup\\Mapper\\EmailVerification\\MapperInterface');
     $evrMapper->expects($this->once())->method('insert')->with($this->isInstanceOf('CdliTwoStageSignup\\Entity\\EmailVerification'))->will($this->returnValue(NULL));
     $service = new Service();
     $service->setEmailVerificationMapper($evrMapper);
     $result = $service->createFromForm($form);
     $this->assertInstanceOf('CdliTwoStageSignup\\Entity\\EmailVerification', $result);
 }
 public function testCleanExpiredVerificationRequests()
 {
     $this->importSchema(__DIR__ . '/_files/singlerecord.sql');
     // Add a second, non-expired request
     $m = new Entity();
     $m->setEmailAddress('*****@*****.**');
     $m->generateRequestKey();
     $this->mapper->insert($m);
     $this->mapper->cleanExpiredVerificationRequests();
     $set = $this->db->query('SELECT * FROM ' . $this->db->platform->quoteIdentifier('user_signup_email_verification'))->execute();
     $this->assertEquals(1, $set->count());
     $actualEntity = $set->current();
     $this->assertEquals($m->getRequestKey(), $actualEntity['request_key']);
     $this->assertEquals($m->getEmailAddress(), $actualEntity['email_address']);
     $this->assertEquals($m->getRequestTime()->format('Y-m-d H:i:s'), $actualEntity['request_time']);
 }
 public function testCleanExpiredVerificationRequests()
 {
     $this->importSchema(__DIR__ . '/_files/singlerecord.sql');
     // Add a second, non-expired request
     $m = new Entity();
     $m->setEmailAddress('*****@*****.**');
     $m->generateRequestKey();
     $this->mapper->insert($m);
     $this->mapper->cleanExpiredVerificationRequests();
     $set = $this->getDBALConnection()->executeQuery('SELECT * FROM user_signup_email_verification')->fetchAll();
     $this->assertEquals(1, count($set));
     $actualEntity = array_pop($set);
     $this->assertEquals($m->getRequestKey(), $actualEntity['request_key']);
     $this->assertEquals($m->getEmailAddress(), $actualEntity['email_address']);
     $this->assertEquals($m->getRequestTime()->format('Y-m-d H:i:s'), $actualEntity['request_time']);
 }
示例#5
0
 public function remove(Model $evrModel)
 {
     $this->delete(array('request_key' => $evrModel->getRequestKey()));
     return true;
 }