summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Joye <pajoye@php.net>2006-09-17 18:03:45 +0000
committerPierre Joye <pajoye@php.net>2006-09-17 18:03:45 +0000
commit442112503a765fc08bb03e5b54f294a51dc84580 (patch)
tree02d4746e86e5c9e17c5fc94e3fdf45d0a1758d89
parentd43c9c11f4fb95eb1a47cb03a492537e65f5d97a (diff)
downloadphp-git-442112503a765fc08bb03e5b54f294a51dc84580.tar.gz
- add test for callback and input_get and input_get_args
this test fails now, the callback never worked with input_get or args fix already done, will be applied with the api shake up.
-rw-r--r--ext/filter/tests/037.phpt39
1 files changed, 39 insertions, 0 deletions
diff --git a/ext/filter/tests/037.phpt b/ext/filter/tests/037.phpt
new file mode 100644
index 0000000000..5e5dc26f84
--- /dev/null
+++ b/ext/filter/tests/037.phpt
@@ -0,0 +1,39 @@
+--TEST--
+GET and data callback tests
+--GET--
+a=1&b=2
+--FILE--
+<?php
+function myfunc($val) {
+ return $val . _ . 'callback';
+}
+echo input_get(INPUT_GET, 'a', FILTER_CALLBACK, 'myfunc');
+echo "\n";
+echo input_get(INPUT_GET, 'b', FILTER_VALIDATE_INT);
+echo "\n";
+$data = "data";
+
+echo filter_data($data, FILTER_CALLBACK, 'myfunc');
+echo "\n";
+
+$res = input_get_args(INPUT_GET, array(
+ 'a' => array(
+ 'filter' => FILTER_CALLBACK,
+ 'options' => 'myfunc'
+ ),
+ 'b' => FILTER_VALIDATE_INT
+ )
+ );
+
+var_dump($res);
+?>
+--EXPECT--
+1_callback
+2
+data_callback
+array(2) {
+ ["a"]=>
+ string(10) "1_callback"
+ ["b"]=>
+ int(2)
+}