コード例 #1
0
 public function validate(Validatable $field)
 {
     if (!parent::validate($field) || !(round($field->getValue()) == $field->getValue())) {
         $field->setError('moet een geheel getal tussen ' . $this->min . ' en ' . $this->max . ' zijn');
         return false;
     }
     return true;
 }
コード例 #2
0
 public function testValidateEmptyValue()
 {
     $v = new NumericValidator();
     $this->assertTrue($v->validate(''));
     $this->assertTrue($v->validate(null));
 }