Exemplo n.º 1
0
 /**
  * Testing setMessage for all messages
  *
  * @group ZF-10690
  */
 public function testSetMultipleMessages()
 {
     $messages = $this->validator->getMessageTemplates();
     $this->assertNotEquals('TestMessage', $messages[EmailAddress::INVALID]);
     $this->validator->setMessage('TestMessage');
     $messages = $this->validator->getMessageTemplates();
     $this->assertEquals('TestMessage', $messages[EmailAddress::INVALID]);
 }
Exemplo n.º 2
0
 /**
  * Testing setMessage for all messages
  *
  * @group ZF-10690
  */
 public function testSetMultipleMessages()
 {
     $messages = $this->validator->getMessageTemplates();
     $this->assertNotEquals('TestMessage', $messages[EmailAddress::INVALID]);
     $this->validator->setMessage('TestMessage');
     foreach ($this->validator->getMessageTemplates() as $message) {
         $this->assertEquals('TestMessage', $message);
     }
     foreach ($this->validator->getHostnameValidator()->getMessageTemplates() as $message) {
         $this->assertEquals('TestMessage', $message);
     }
 }
Exemplo n.º 3
0
 public function getInputFilter()
 {
     if ($this->filter == null) {
         $this->filter = new InputFilter();
         $inputFilter = parent::getInputFilter();
         $email = new Input('email');
         $email->setRequired(true);
         $email->setAllowEmpty(false);
         $objectExists = new ObjectExists(array('object_repository' => $this->objectManager->getRepository(User::getClass()), 'fields' => 'email'));
         $objectExists->setMessage($this->translator->translate('forgotPassword.email.notExists'), ObjectExists::ERROR_NO_OBJECT_FOUND);
         $emailAddress = new EmailAddress();
         $emailAddress->setMessage($this->translator->translate('forgotPassword.email.invalidFormat'), $emailAddress::INVALID_FORMAT);
         $email->getValidatorChain()->attach($emailAddress, true)->attach($objectExists);
         $this->filter->add($email);
     }
     return $this->filter;
 }
Exemplo n.º 4
0
 /**
  * @return EmailAddress
  */
 public static function emailValidator()
 {
     $validator = new EmailAddress();
     $validator->setMessage("Email tidak valid.");
     return $validator;
 }