summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2010-04-20 19:46:30 +0000
committerStanislav Malyshev <stas@php.net>2010-04-20 19:46:30 +0000
commit10a9f48eeeb20fae3eef5d5b1b35d1bcf0bd1942 (patch)
tree3cc04ff1ad8b8dfeb6feeb62f01c1a192cb2f7f1 /Zend
parentf2d23c7f375c5ab70366ed7b57a50ce11bc45d4b (diff)
downloadphp-git-10a9f48eeeb20fae3eef5d5b1b35d1bcf0bd1942.tar.gz
add test for self:: and static::
Diffstat (limited to 'Zend')
-rwxr-xr-xZend/tests/closure_037.phpt47
1 files changed, 47 insertions, 0 deletions
diff --git a/Zend/tests/closure_037.phpt b/Zend/tests/closure_037.phpt
new file mode 100755
index 0000000000..4b24c85d16
--- /dev/null
+++ b/Zend/tests/closure_037.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Closure 037: self:: and static:: within closures
+--FILE--
+<?php
+class A {
+ private $x = 0;
+
+ function getClosure () {
+ return function () {
+ $this->x++;
+ self::printX();
+ self::print42();
+ static::print42();
+ };
+ }
+
+ function printX () {
+ echo $this->x."\n";
+ }
+
+ function print42() {
+ echo "42\n";
+ }
+}
+
+class B extends A {
+ function print42() {
+ echo "forty two\n";
+ }
+}
+
+$a = new A;
+$closure = $a->getClosure();
+$closure();
+$b = new B;
+$closure = $b->getClosure();
+$closure();
+?>
+Done.
+--EXPECTF--
+1
+42
+42
+1
+42
+forty two
+Done. \ No newline at end of file