Beispiel #1
0
 public function testInvalidTypes()
 {
     $values = array(array(), new \stdClass());
     foreach ($values as $value) {
         $this->assertFalse($this->validator->isValid($value));
     }
 }
 public function createInputFilter()
 {
     $inputFilter = new InputFilter();
     $inputFilter->add(array('name' => 'name', 'required' => true, 'validators' => array(array('name' => 'Zend\\I18n\\Validator\\Alpha', 'options' => array('allowWhiteSpace' => false)))));
     $inputFilter->add(array('name' => 'cognome', 'required' => true, 'validators' => array(array('name' => 'Zend\\I18n\\Validator\\Alpha', 'options' => array('allowWhiteSpace' => false)))));
     $inputFilter->add(array('name' => 'email', 'required' => true, 'validators' => array(array('name' => 'Zend\\Validator\\EmailAddress', 'options' => array('allowWhiteSpace' => false)))));
     $phoneValidator = new PhoneNumber();
     $phoneValidator->setCountry('it');
     $inputFilter->add(array('name' => 'num', 'required' => true, 'validators' => array($phoneValidator)));
     return $inputFilter;
 }
Beispiel #3
0
 public function getPhoneValidator()
 {
     if ($this->phoneValidator === NULL) {
         $validator = new PhoneNumber();
         $validator->setOptions($this->getPhoneConfig())->setMessages(array(PhoneNumber::NO_MATCH => $this->getErrorMessage('PHONENUMBER::NO_MATCH'), PhoneNumber::UNSUPPORTED => $this->getErrorMessage('PHONENUMBER::UNSUPPORTED'), PhoneNumber::INVALID => $this->getErrorMessage('PHONENUMBER::INVALID')));
         $this->setPhoneValidator($validator);
     }
     return $this->phoneValidator;
 }