com php-src: Add two initial tests: Zend/tests/varSyntax/indirectFcall.phpt Zend/tests/varSyntax/staticMember.phpt
| From: | Nikita Popov | Date: | Sat, 31 May 2014 14:33:52 +0000 |
| Subject: | com php-src: Add two initial tests: Zend/tests/varSyntax/indirectFcall.phpt Zend/tests/varSyntax/staticMember.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-81078@lists.php.net to get a copy of this message | ||
Commit: 4ec505f9b5b1d64f180d7f13ec8a1363485afc92
Author: Nikita Popov <nikic@php.net> Sat, 31 May 2014 16:33:52 +0200
Parents: f48241f734b7994c69bfd2636169982b6e5c9045
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=4ec505f9b5b1d64f180d7f13ec8a1363485afc92
Log:
Add two initial tests
Changed paths:
A Zend/tests/varSyntax/indirectFcall.phpt
A Zend/tests/varSyntax/staticMember.phpt
Diff:
diff --git a/Zend/tests/varSyntax/indirectFcall.phpt b/Zend/tests/varSyntax/indirectFcall.phpt
new file mode 100644
index 0000000..e42376a
--- /dev/null
+++ b/Zend/tests/varSyntax/indirectFcall.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Indirect function calls
+--FILE--
+<?php
+
+function id($x = 'id') { return $x; }
+
+var_dump(0);
+
+id('var_dump')(1);
+id('id')('var_dump')(2);
+id('id')('id')('var_dump')(3);
+id()()('var_dump')(4);
+
+id(['udef', 'id'])[1]()('var_dump')(5);
+// (id((object) ['a' => 'id', 'b' =>
'udef'])->a)();
+
+?>
+--EXPECT--
+int(0)
+int(1)
+int(2)
+int(3)
+int(4)
+int(5)
diff --git a/Zend/tests/varSyntax/staticMember.phpt b/Zend/tests/varSyntax/staticMember.phpt
new file mode 100644
index 0000000..13325bb
--- /dev/null
+++ b/Zend/tests/varSyntax/staticMember.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Static member access
+--FILE--
+<?php
+
+class A {
+ public static $b = 0;
+ public static $c = [0, 1];
+}
+
+$A_str = 'A';
+$A_obj = new A;
+$b_str = 'b';
+$c_str = 'c';
+
+var_dump(A::$b);
+var_dump($A_str::$b);
+var_dump($A_obj::$b);
+var_dump(('A' . '')::$b);
+var_dump('A'::$b);
+var_dump('A'[0]::$b);
+var_dump(A::$$b_str);
+var_dump(A::$$c_str[1]);
+
+?>
+--EXPECT--
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)