]> granicus.if.org Git - php/commitdiff
Add two initial tests
authorNikita Popov <nikic@php.net>
Sat, 31 May 2014 14:33:52 +0000 (16:33 +0200)
committerNikita Popov <nikic@php.net>
Sat, 31 May 2014 14:33:52 +0000 (16:33 +0200)
Zend/tests/varSyntax/indirectFcall.phpt [new file with mode: 0644]
Zend/tests/varSyntax/staticMember.phpt [new file with mode: 0644]

diff --git a/Zend/tests/varSyntax/indirectFcall.phpt b/Zend/tests/varSyntax/indirectFcall.phpt
new file mode 100644 (file)
index 0000000..e42376a
--- /dev/null
@@ -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 (file)
index 0000000..13325bb
--- /dev/null
@@ -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)