From bc0df38e887e362761737227dd3c7b9b252e946c Mon Sep 17 00:00:00 2001 From: Aaron Piotrowski Date: Thu, 25 Jun 2015 19:46:28 -0500 Subject: [PATCH] Added more indirect call tests, remove invalid test --- Zend/tests/call_static_005.phpt | 21 --------- Zend/tests/indirect_call_string_001.phpt | 42 +++++++++++++++++ Zend/tests/indirect_call_string_002.phpt | 59 ++++++++++++++++++++++++ 3 files changed, 101 insertions(+), 21 deletions(-) delete mode 100644 Zend/tests/call_static_005.phpt create mode 100644 Zend/tests/indirect_call_string_001.phpt create mode 100644 Zend/tests/indirect_call_string_002.phpt diff --git a/Zend/tests/call_static_005.phpt b/Zend/tests/call_static_005.phpt deleted file mode 100644 index 3b8d3465f6..0000000000 --- a/Zend/tests/call_static_005.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -Invalid method name in dynamic static call ---FILE-- -getMessage(); -} - -?> ---EXPECT-- -Call to undefined function foo::() diff --git a/Zend/tests/indirect_call_string_001.phpt b/Zend/tests/indirect_call_string_001.phpt new file mode 100644 index 0000000000..4493d6b3b8 --- /dev/null +++ b/Zend/tests/indirect_call_string_001.phpt @@ -0,0 +1,42 @@ +--TEST-- +Indirect call with 'Class::method' syntax with class in namespace +--FILE-- + +--EXPECT-- +Static method called! +Static method called! +Static method called with args: arg1, arg2, arg3 +Static method called with args: arg1, arg2, arg3 diff --git a/Zend/tests/indirect_call_string_002.phpt b/Zend/tests/indirect_call_string_002.phpt new file mode 100644 index 0000000000..40c913ac4c --- /dev/null +++ b/Zend/tests/indirect_call_string_002.phpt @@ -0,0 +1,59 @@ +--TEST-- +Indirect call with empty class and/or method name. +--FILE-- +getMessage() . "\n"; +} + +// Test Class::method syntax with empty class name +$callback = '::method'; +try { + $callback(); +} catch (Error $e) { + echo $e->getMessage() . "\n"; +} + +// Test array syntax with empty class and method name +$callback = ['', '']; +try { + $callback(); +} catch (Error $e) { + echo $e->getMessage() . "\n"; +} + +// Test Class::method syntax with empty class and method name +$callback = '::'; +try { + $callback(); +} catch (Error $e) { + echo $e->getMessage() . "\n"; +} +?> +--EXPECT-- +string(0) "" +string(0) "" +Class '' not found +Class '' not found +Class '' not found +Class '' not found -- 2.50.1