started some input validation code and unit tests for it
[gwvp.git] / unittests / inputvalidate.php
1 <?php
2 $lib_base = "../gwvplib/";
3
4 // initial http file
5 $WEB_ROOT_FS = realpath(dirname(__FILE__));
6 $BASE_URL = dirname($_SERVER["PHP_SELF"]);
7
8 global $WEB_ROOT_FS, $BASE_URL, $repo_base, $data_directory, $db_type, $db_name, $db_username, $db_password;
9
10 // add gwvplib as if it were a path in ../gwvplib
11 if(file_exists($lib_base)) {
12         $path = realpath($lib_base);
13         set_include_path(get_include_path().PATH_SEPARATOR.$path);
14 }
15
16 require_once("gwvplib.php");
17
18
19 echo "Doing email validation\n";
20 echo "\tasfd@asdf.com (should pass)\n";
21 if(gwvp_checkEmail("asdf@asfd.com")) {
22         echo "\tpass\n";
23 } else {
24         echo "\tFAIL\n";
25 }
26
27 echo "\tasfd@asd+af..com (should fail)\n";
28 if(gwvp_checkEmail("asfd@asd+af..com")) {
29         echo "\tPASS\n";
30 } else {
31         echo "\tfail\n";
32 }
33
34
35 ?>