From: Felipe Pena Date: Tue, 14 Jun 2011 02:05:37 +0000 (+0000) Subject: - New tests for new feature X-Git-Tag: php-5.4.0alpha1~39 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a5974fdba8d073deca8bbf0751f92c7172e7a5e8;p=php - New tests for new feature --- diff --git a/Zend/tests/indirect_call_array_001.phpt b/Zend/tests/indirect_call_array_001.phpt new file mode 100644 index 0000000000..56675b81a5 --- /dev/null +++ b/Zend/tests/indirect_call_array_001.phpt @@ -0,0 +1,11 @@ +--TEST-- +Indirect method call by array - Invalid class name +--FILE-- + +--EXPECTF-- +Fatal error: Class 'a' not found in %s on line %d diff --git a/Zend/tests/indirect_call_array_002.phpt b/Zend/tests/indirect_call_array_002.phpt new file mode 100644 index 0000000000..013fa559fe --- /dev/null +++ b/Zend/tests/indirect_call_array_002.phpt @@ -0,0 +1,11 @@ +--TEST-- +Indirect method call by array - Invalid method name +--FILE-- + +--EXPECTF-- +Fatal error: Call to undefined method stdClass::b() in %s on line %d diff --git a/Zend/tests/indirect_call_array_003.phpt b/Zend/tests/indirect_call_array_003.phpt new file mode 100644 index 0000000000..498c580c48 --- /dev/null +++ b/Zend/tests/indirect_call_array_003.phpt @@ -0,0 +1,38 @@ +--TEST-- +Indirect method call by array - Calling __call() and __callStatic() +--FILE-- + +--EXPECTF-- +From foo::__callStatic: +string(3) "abc" + +Notice: Undefined variable: this in %s on line %d +NULL +From foo::__call: +string(3) "abc" +object(foo)#%d (0) { +} + diff --git a/Zend/tests/indirect_call_array_004.phpt b/Zend/tests/indirect_call_array_004.phpt new file mode 100644 index 0000000000..350f720648 --- /dev/null +++ b/Zend/tests/indirect_call_array_004.phpt @@ -0,0 +1,71 @@ +--TEST-- +Indirect method call by array - Testing exception and method magics +--FILE-- +getMessage(), "\n"; +} + +$arr = array('foo', '123'); + +try { + $arr(); +} +catch (Exception $e) { + echo $e->getMessage(), "\n"; +} + + +echo "------\n"; + +$foo = new foo; +$arr = array($foo, 'abc'); + +try { + $arr(); +} +catch (Exception $e) { + echo $e->getMessage(), "\n"; +} + + +$foo = new foo; +$arr = array($foo, '123'); + +try { + $arr(); +} +catch (Exception $e) { + echo $e->getMessage(), "\n"; +} + +?> +--EXPECTF-- +foo +From foo::__callStatic: +123 +------ +foo +From foo::__call: +123