From: Aaron Piotrowski Date: Fri, 26 Jun 2015 00:46:28 +0000 (-0500) Subject: Added more indirect call tests, remove invalid test X-Git-Tag: php-7.1.0alpha3~25^2~175^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bc0df38e887e362761737227dd3c7b9b252e946c;p=php Added more indirect call tests, remove invalid test --- 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