Exemplo n.º 1
0
 /**
  * Ensures that getMessageVariables() returns an array of
  * strings and that these strings that can be used as variables
  * in a message.
  */
 public function testGetMessageVariables()
 {
     $vars = $this->validator->getMessageVariables();
     $this->assertInternalType('array', $vars);
     $this->assertEquals(array('min', 'max'), $vars);
     $message = 'variables: %notvar% ';
     foreach ($vars as $var) {
         $message .= "%{$var}% ";
     }
     $this->validator->setMessage($message, StringLength::TOO_SHORT);
     $this->assertFalse($this->validator->isValid('abc'));
     $messages = $this->validator->getMessages();
     $this->assertEquals('variables: %notvar% 4 8 ', current($messages));
 }