svn: /php/php-src/trunk/Zend/tests/ closure_037.phpt
| From: | Stanislav Malyshev | Date: | Tue, 20 Apr 2010 19:46:30 +0000 |
| Subject: | svn: /php/php-src/trunk/Zend/tests/ closure_037.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-62307@lists.php.net to get a copy of this message | ||
stas Tue, 20 Apr 2010 19:46:30 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=298233
Log:
add test for self:: and static::
Changed paths:
A php/php-src/trunk/Zend/tests/closure_037.phpt
Added: php/php-src/trunk/Zend/tests/closure_037.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/closure_037.phpt (rev 0)
+++ php/php-src/trunk/Zend/tests/closure_037.phpt 2010-04-20 19:46:30 UTC (rev 298233)
@@ -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
Property changes on: php/php-src/trunk/Zend/tests/closure_037.phpt
___________________________________________________________________
Added: svn:executable
+ *