Exemplo n.º 1
0
 /**
  * test isValid() with invalid value
  */
 public function testIsNotValid()
 {
     $validator = new Idun_Validate_And(array(new Zend_Validate_StringLength(7, 32), new Zend_Validate_EmailAddress()));
     $this->assertFalse($validator->isValid('dummy'));
     $this->assertArrayHasKey(Zend_Validate_StringLength::TOO_SHORT, $validator->getMessages());
     $this->assertFalse($validator->isValid('invalid'));
     $this->assertArrayHasKey(Zend_Validate_EmailAddress::INVALID_FORMAT, $validator->getMessages());
 }
Exemplo n.º 2
0
 /**
  * @access public
  * @param  mixed $value
  * @return boolean
  */
 public function isValid($value)
 {
     if (!parent::isValid($value)) {
         $this->_messages = array();
         $this->_errors = array();
         return true;
     }
     $this->_error(self::ALL_CONDITIONS_TRUE);
     return false;
 }