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

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

  <title>FormValidator Test</title>
</head>

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

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

  $form = FormValidator::create(
    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 ($form->getErrors() as $error) {
    echo "$error<br />";
  }

  ?>
  <br />
  <pre>
    <?php
    print_r($form->getField("E-Mail Valid"));
    echo "\n\n";
    print_r($form->getField("Name"));
    ?>
  </pre>
</body>

</html>