Beispiel #1
0
 public function testExampleNumbersAgainstPossible()
 {
     $this->validator->allowPossible(true);
     foreach ($this->phone as $country => $parameters) {
         $this->validator->setCountry($country);
         foreach ($parameters['patterns']['example'] as $type => $value) {
             $this->validator->allowedTypes(array($type));
             $this->assertTrue($this->validator->isValid($value));
             // check with country code:
             $value = $parameters['code'] . $value;
             $this->assertTrue($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 testSetCountryMethodIsCaseInsensitive()
 {
     $this->validator->setCountry('us');
     $this->assertSame('US', $this->validator->getCountry());
 }