コード例 #1
0
ファイル: MessageTest.php プロジェクト: nevvermind/zf2
 /**
  * Ensures that we can set more than one message at a time,
  * by passing an array of key/message pairs.  Both messages
  * should be defined.
  *
  * @return void
  */
 public function testSetMessages()
 {
     $this->_validator->setMessages(array(Validator\StringLength::TOO_LONG => 'Your value is too long', Validator\StringLength::TOO_SHORT => 'Your value is too short'));
     $this->assertFalse($this->_validator->isValid('abcdefghij'));
     $messages = $this->_validator->getMessages();
     $this->assertEquals('Your value is too long', current($messages));
     $this->assertFalse($this->_validator->isValid('abc'));
     $messages = $this->_validator->getMessages();
     $this->assertEquals('Your value is too short', current($messages));
 }