]> granicus.if.org Git - php/commitdiff
- move 033.php to 033_run.php, 033.php cannot be run
authorPierre Joye <pajoye@php.net>
Thu, 25 May 2006 11:13:23 +0000 (11:13 +0000)
committerPierre Joye <pajoye@php.net>
Thu, 25 May 2006 11:13:23 +0000 (11:13 +0000)
ext/filter/tests/033.phpt
ext/filter/tests/033_run.php [new file with mode: 0644]

index 3c87d0213cdf3c30eb2da498576ad9b60052c90e..c6ec13323e851e22a189949dd613028aae5d270d 100644 (file)
@@ -2,7 +2,7 @@
 Test all filters returned by input_filters_list()
 --FILE--
 <?php
-include './033.php';
+include dirname(__FILE__) . '/033_run.php';
 ?>
 --EXPECT--     
 int                      1                                               123                                               
diff --git a/ext/filter/tests/033_run.php b/ext/filter/tests/033_run.php
new file mode 100644 (file)
index 0000000..229e7ba
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+function test($data) {
+  return strtoupper($data);
+}
+$data = array("PHP","1","foo@bar.com","http://a.b.c","1.2.3.4","123","123abc<>()","O'Henry", "하퍼");
+foreach(input_filters_list() as $filter) {
+  if($filter=="validate_regexp") {
+    foreach($data as $k=>$d) $result[$k] = filter_data($d,input_name_to_filter($filter),array("regexp"=>'/^O.*/'));
+  } else {
+    foreach($data as $k=>$d) $result[$k] = filter_data($d,input_name_to_filter($filter),"test");
+  }
+  printf("%-20s",$filter);
+  printf("%-5s",$result[0]);
+  printf("%-3s",$result[1]);
+  printf("%-15s",$result[2]);
+  printf("%-20s",$result[3]);
+  printf("%-10s",$result[4]);
+  printf("%-5s",$result[5]);
+  printf("%-20s",$result[6]);
+  printf("%-15s",$result[7]);
+  printf("%-10s\n",$result[8]);
+}
+?>