本文整理汇总了PHP中Zend_Validate::getMessageLength方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Validate::getMessageLength方法的具体用法?PHP Zend_Validate::getMessageLength怎么用?PHP Zend_Validate::getMessageLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Validate
的用法示例。
在下文中一共展示了Zend_Validate::getMessageLength方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testMaximumErrorMessageLength
public function testMaximumErrorMessageLength()
{
require_once 'Zend/Validate.php';
$this->assertEquals(-1, Zend_Validate::getMessageLength());
Zend_Validate_Abstract::setMessageLength(10);
$this->assertEquals(10, Zend_Validate::getMessageLength());
$translator = new Zend_Translate('array', array('fooMessage' => 'This is the translated message for %value%'), 'en');
$this->validator->setTranslator($translator);
$this->assertFalse($this->validator->isValid('bar'));
$messages = $this->validator->getMessages();
$this->assertTrue(array_key_exists('fooMessage', $messages));
$this->assertEquals('This is...', $messages['fooMessage']);
}
示例2: testSetGetMessageLengthLimitation
public function testSetGetMessageLengthLimitation()
{
Zend_Validate::setMessageLength(5);
$this->assertEquals(5, Zend_Validate::getMessageLength());
$valid = new Zend_Validate_Between(1, 10);
$this->assertFalse($valid->isValid(24));
$message = current($valid->getMessages());
$this->assertTrue(strlen($message) <= 5);
}