예제 #1
0
 public function isValidValue($unit, $value)
 {
     $result = true;
     $formValues = $unit->getFormValues();
     if (isset($formValues['type'])) {
         if ($formValues['enableRequired'] && !$this->formValidation->isFilled($value)) {
             $result = false;
         } elseif ($formValues['type'] === InputType::EMAIL && (!$this->formValidation->isValidEmailAddress($value) || !$this->formValidation->isFilled($value))) {
             $result = false;
         } elseif ($formValues['type'] === InputType::NUMERIC && !$this->formValidation->isNumeric($value)) {
             $result = false;
         }
     } else {
         if (isset($formValues['listType'])) {
             if ($formValues['enableRequired'] && is_null($value)) {
                 $result = false;
             }
         }
     }
     return $result;
 }
예제 #2
0
 /**
  * @covers FormValidation::isValidEmailAddress
  */
 public function testIsNotValidEmailAddress()
 {
     $result = $this->object->isValidEmailAddress('chris@rukzukcom');
     $this->assertFalse($result);
 }