From 3cf7638cf2d01a1e9b2ae5d4e17bea87b6799f6c Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sun, 19 Jul 2009 16:31:43 +0000 Subject: [PATCH] - New tests --- Zend/tests/call_user_func_001.phpt | 35 ++++++++++++++++++++++++++++++ Zend/tests/call_user_func_002.phpt | 29 +++++++++++++++++++++++++ Zend/tests/call_user_func_003.phpt | 31 ++++++++++++++++++++++++++ 3 files changed, 95 insertions(+) create mode 100644 Zend/tests/call_user_func_001.phpt create mode 100644 Zend/tests/call_user_func_002.phpt create mode 100644 Zend/tests/call_user_func_003.phpt diff --git a/Zend/tests/call_user_func_001.phpt b/Zend/tests/call_user_func_001.phpt new file mode 100644 index 00000000000..e9b35f95700 --- /dev/null +++ b/Zend/tests/call_user_func_001.phpt @@ -0,0 +1,35 @@ +--TEST-- +Testing call_user_func inside namespace +--FILE-- + +--EXPECTF-- +%string|unicode%(6) "foobar" + +Warning: call_user_func() expects parameter 1 to be a valid callback, cannot access private method testing\foo::priv() in %s on line %d + +Warning: call_user_func() expects parameter 1 to be a valid callback, cannot access protected method testing\foo::prot() in %s on line %d diff --git a/Zend/tests/call_user_func_002.phpt b/Zend/tests/call_user_func_002.phpt new file mode 100644 index 00000000000..e79dd1a759c --- /dev/null +++ b/Zend/tests/call_user_func_002.phpt @@ -0,0 +1,29 @@ +--TEST-- +Testing call_user_func() with autoload and passing invalid params +--FILE-- + +--EXPECTF-- +%unicode|string%(3) "foo" + +Warning: call_user_func() expects parameter 1 to be a valid callback, class 'foo' not found in %s on line %d + +Warning: call_user_func() expects parameter 1 to be a valid callback, class '' not found in %s on line %d + +Notice: Undefined variable: foo in %s on line %d + +Warning: call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d + +Notice: Undefined variable: foo in %s on line %d + +Warning: call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d diff --git a/Zend/tests/call_user_func_003.phpt b/Zend/tests/call_user_func_003.phpt new file mode 100644 index 00000000000..d516584eb2f --- /dev/null +++ b/Zend/tests/call_user_func_003.phpt @@ -0,0 +1,31 @@ +--TEST-- +Testing call_user_func() with closures +--FILE-- +__invoke()); +var_dump(call_user_func(function() use (&$foo) { return $foo; }, '__invoke')); + +?> +--EXPECTF-- +%unicode|string%(3) "OK!" +object(Closure)#%d (1) { + [%u|b%"static"]=> + array(1) { + [%u|b%"instance"]=> + object(Closure)#%d (0) { + } + } +}