當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Validate_StringLength::getErrors方法代碼示例

本文整理匯總了PHP中Zend_Validate_StringLength::getErrors方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Validate_StringLength::getErrors方法的具體用法?PHP Zend_Validate_StringLength::getErrors怎麽用?PHP Zend_Validate_StringLength::getErrors使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_Validate_StringLength的用法示例。


在下文中一共展示了Zend_Validate_StringLength::getErrors方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testGetErrors

 /**
  * Ensures that the getError() function returns an array of
  * message key values corresponding to the messages.
  *
  * @return void
  */
 public function testGetErrors()
 {
     $this->assertFalse($this->_validator->isValid('abcdefghij'));
     $messages = $this->_validator->getMessages();
     $this->assertEquals("'abcdefghij' is greater than 8 characters long", $messages[0]);
     $errors = $this->_validator->getErrors();
     $this->assertEquals(Zend_Validate_StringLength::TOO_LONG, $errors[0]);
 }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:14,代碼來源:MessageTest.php

示例2: testGetErrors

 /**
  * Ensures that the getError() function returns an array of
  * message key values corresponding to the messages.
  *
  * @return void
  */
 public function testGetErrors()
 {
     $inputInvalid = 'abcdefghij';
     $this->assertFalse($this->_validator->isValid($inputInvalid));
     $messages = $this->_validator->getMessages();
     $this->assertEquals("'{$inputInvalid}' is more than 8 characters long", current($messages));
     $errors = $this->_validator->getErrors();
     $this->assertEquals(Zend_Validate_StringLength::TOO_LONG, current($errors));
 }
開發者ID:omusico,項目名稱:logica,代碼行數:15,代碼來源:MessageTest.php

示例3: isValid

 /**
  * Validate "syntax" of this field
  * 
  * @throws Setup_Exception_InvalidSchema if {@param $throwException} is set to true
  *  
  * @param $throwException
  * @return bool
  */
 public function isValid($throwException = false)
 {
     $isValid = true;
     $messages = array();
     $nameValidator = new Zend_Validate_StringLength(1, 30);
     if (!$nameValidator->isValid($this->name)) {
         $isValid = false;
         $messages = array_merge($messages, $nameValidator->getErrors());
     }
     if (!$isValid) {
         Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . ' Invalid schema specified for field ' . $this->name . ': ' . print_r($messages, 1));
         if ($throwException) {
             throw new Setup_Exception_InvalidSchema('Invalid schema specified for field ' . $this->name . ': ' . print_r($messages, 1));
         }
     }
     return $isValid;
 }
開發者ID:ingoratsdorf,項目名稱:Tine-2.0-Open-Source-Groupware-and-CRM,代碼行數:25,代碼來源:Abstract.php


注:本文中的Zend_Validate_StringLength::getErrors方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。