Пример #1
0
 /**
  * Ensures that getMessages() returns expected default value
  *
  * @return void
  */
 public function testGetMessages()
 {
     $validator = new GreaterThan(10);
     $this->assertEquals(array(), $validator->getMessages());
 }
Пример #2
0
 public function testCorrectNotInclusiveMessageReturn()
 {
     $valuesToValidate = array(0, 0.5, 5, 9);
     foreach ($valuesToValidate as $value) {
         $validator = new GreaterThan(array('min' => 10, 'inclusive' => true));
         $validator->isValid($value);
         $message = $validator->getMessages();
         $this->assertArrayHaskey('notGreaterThanInclusive', $message);
         $this->assertEquals($message['notGreaterThanInclusive'], "The input is not greater or equal than '10'");
     }
 }