// Make sure we have a form error for this element.
$this->assertTrue(isset($errors[$element]),"Check empty($key) '$type' field '$element'");
}
elseif($type=='select'){
// Select elements are going to have validation errors with empty
// input, since those are illegal choices. Just make sure the
// error is not "field is required".
$this->assertTrue((empty($errors[$element])||strpos('field is required',$errors[$element])===FALSE),"Optional '$type' field '$element' is not treated as a required element");
if(!empty($form_output)){
// Make sure the form element is marked as required.
$this->assertTrue(preg_match($required_marker_preg,$form_output),"Required '$type' field is marked as required");
}
}
else{
// Make sure there is *no* form error for this element.
$this->assertTrue(empty($errors[$element]),"Optional '$type' field '$element' has no errors with empty input");
if(!empty($form_output)){
// Make sure the form element is *not* marked as required.
$this->assertFalse(preg_match($required_marker_preg,$form_output),"Optional '$type' field is not marked as required");
}
if($type=='select'){
// Select elements are going to have validation errors with empty
// input, since those are illegal choices. Just make sure the
// error is not "field is required".
$this->assertTrue((empty($errors[$element])||strpos('field is required',$errors[$element])===FALSE),"Optional '$type' field '$element' is not treated as a required element");
}
else{
// Make sure there is *no* form error for this element.
$this->assertTrue(empty($errors[$element]),"Optional '$type' field '$element' has no errors with empty input");