<!DOCTYPE html>
<html lang="en">

<head>
  <?php require_once "../../../base/meta.php" ?>

  <title>FieldValidator Test</title>
</head>

<body>
  <?php
  require_once "../../../base/settings.php";
  require_once "../../../base/headers.php";
  Headers::html();

  //Testdatei für die Klasse FieldValidator
  require_once "../classes/fieldValidator/fieldValidator.php";

  $validators = [
    FieldValidator::create("Empty Valid", "", "string"),
    FieldValidator::create("Empty Invalid", "", "string")->isRequired(),
    FieldValidator::create("MinLen Valid", "ssss", "string")->withMinLen(4),
    FieldValidator::create("MinLen Invalid", "sss", "string")->withMinLen(4),
    FieldValidator::create("MaxLen Valid", "ssss", "string")->withMaxLen(4),
    FieldValidator::create("MaxLen Invalid", "sssss", "string")->withMaxLen(4),
    FieldValidator::create("E-Mail Valid", "khofmann@fu-berlin.de", "email"),
    FieldValidator::create("E-Mail Invalid", "khofmann@fu-berlin de", "email"),
  ];

  foreach ($validators as $validator) {
    echo "<b>" . $validator->getName() .  "</b>: ";
    echo $validator->isValid() ? "<em>True</em>" : "<em>False</em>" . " with " . $validator->getError();
    echo "<br />";
  }
  ?>
</body>

</html>