felipe                                   Sun, 20 Dec 2009 22:04:55 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=292379

Log:
- New tests

Changed paths:
    A   php/php-src/branches/PHP_5_3/Zend/tests/call_user_func_004.phpt
    A   php/php-src/branches/PHP_5_3/Zend/tests/call_user_func_005.phpt
    A   php/php-src/branches/PHP_5_3/Zend/tests/closure_035.phpt
    A   php/php-src/trunk/Zend/tests/call_user_func_004.phpt
    A   php/php-src/trunk/Zend/tests/call_user_func_005.phpt
    A   php/php-src/trunk/Zend/tests/closure_035.phpt

Added: php/php-src/branches/PHP_5_3/Zend/tests/call_user_func_004.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/tests/call_user_func_004.phpt             
                (rev 0)
+++ php/php-src/branches/PHP_5_3/Zend/tests/call_user_func_004.phpt     
2009-12-20 22:04:55 UTC (rev 292379)
@@ -0,0 +1,18 @@
+--TEST--
+Calling non-static method with call_user_func()
+--FILE--
+<?php
+
+class foo {
+       public function teste() {
+               $this->a = 1;
+       }
+}
+
+call_user_func(array('foo', 'teste'));
+
+?>
+--EXPECTF--
+Strict Standards: call_user_func() expects parameter 1 to be a valid callback, 
non-static method foo::teste() should not be called statically in %s on line %d
+
+Fatal error: Using $this when not in object context in %s on line %d


Property changes on: 
php/php-src/branches/PHP_5_3/Zend/tests/call_user_func_004.phpt
___________________________________________________________________
Added: svn:keywords
   + Id Rev Revision
Added: svn:eol-style
   + native

Added: php/php-src/branches/PHP_5_3/Zend/tests/call_user_func_005.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/tests/call_user_func_005.phpt             
                (rev 0)
+++ php/php-src/branches/PHP_5_3/Zend/tests/call_user_func_005.phpt     
2009-12-20 22:04:55 UTC (rev 292379)
@@ -0,0 +1,35 @@
+--TEST--
+Passing Closure as parameter to an non-existent function
+--FILE--
+<?php
+
+class foo {
+       public static function __callstatic($x, $y) {
+               var_dump($x,$y);
+               return 1;
+       }
+
+       public function teste() {
+               return foo::x(function &($a=1,$b) { });
+       }
+}
+
+var_dump(call_user_func(array('foo', 'teste')));
+
+?>
+--EXPECTF--
+Strict Standards: call_user_func() expects parameter 1 to be a valid callback, 
non-static method foo::teste() should not be called statically in %s on line %d
+%string|unicode%(1) "x"
+array(1) {
+  [0]=>
+  object(Closure)#%d (1) {
+    ["parameter"]=>
+    array(2) {
+      ["$a"]=>
+      string(10) "<required>"
+      ["$b"]=>
+      string(10) "<required>"
+    }
+  }
+}
+int(1)


Property changes on: 
php/php-src/branches/PHP_5_3/Zend/tests/call_user_func_005.phpt
___________________________________________________________________
Added: svn:keywords
   + Id Rev Revision
Added: svn:eol-style
   + native

Added: php/php-src/branches/PHP_5_3/Zend/tests/closure_035.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/tests/closure_035.phpt                    
        (rev 0)
+++ php/php-src/branches/PHP_5_3/Zend/tests/closure_035.phpt    2009-12-20 
22:04:55 UTC (rev 292379)
@@ -0,0 +1,31 @@
+--TEST--
+Testing recursion detection with Closures
+--FILE--
+<?php
+
+$x = function () use (&$x) {
+       $h = function () use ($x) {
+               var_dump($x);
+               return 1;
+       };
+       return $h();
+};
+
+var_dump($x());
+
+?>
+--EXPECTF--
+object(Closure)#%d (1) {
+  ["static"]=>
+  array(1) {
+    [%u|b%"x"]=>
+    &object(Closure)#%d (1) {
+      ["static"]=>
+      array(1) {
+        [%u|b%"x"]=>
+        *RECURSION*
+      }
+    }
+  }
+}
+int(1)


Property changes on: php/php-src/branches/PHP_5_3/Zend/tests/closure_035.phpt
___________________________________________________________________
Added: svn:keywords
   + Id Rev Revision
Added: svn:eol-style
   + native

Added: php/php-src/trunk/Zend/tests/call_user_func_004.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/call_user_func_004.phpt                        
        (rev 0)
+++ php/php-src/trunk/Zend/tests/call_user_func_004.phpt        2009-12-20 
22:04:55 UTC (rev 292379)
@@ -0,0 +1,18 @@
+--TEST--
+Calling non-static method with call_user_func()
+--FILE--
+<?php
+
+class foo {
+       public function teste() {
+               $this->a = 1;
+       }
+}
+
+call_user_func(array('foo', 'teste'));
+
+?>
+--EXPECTF--
+Strict Standards: call_user_func() expects parameter 1 to be a valid callback, 
non-static method foo::teste() should not be called statically in %s on line %d
+
+Fatal error: Using $this when not in object context in %s on line %d


Property changes on: php/php-src/trunk/Zend/tests/call_user_func_004.phpt
___________________________________________________________________
Added: svn:keywords
   + Id Rev Revision
Added: svn:eol-style
   + native

Added: php/php-src/trunk/Zend/tests/call_user_func_005.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/call_user_func_005.phpt                        
        (rev 0)
+++ php/php-src/trunk/Zend/tests/call_user_func_005.phpt        2009-12-20 
22:04:55 UTC (rev 292379)
@@ -0,0 +1,35 @@
+--TEST--
+Passing Closure as parameter to an non-existent function
+--FILE--
+<?php
+
+class foo {
+       public static function __callstatic($x, $y) {
+               var_dump($x,$y);
+               return 1;
+       }
+
+       public function teste() {
+               return foo::x(function &($a=1,$b) { });
+       }
+}
+
+var_dump(call_user_func(array('foo', 'teste')));
+
+?>
+--EXPECTF--
+Strict Standards: call_user_func() expects parameter 1 to be a valid callback, 
non-static method foo::teste() should not be called statically in %s on line %d
+%string|unicode%(1) "x"
+array(1) {
+  [0]=>
+  object(Closure)#%d (1) {
+    ["parameter"]=>
+    array(2) {
+      ["$a"]=>
+      string(10) "<required>"
+      ["$b"]=>
+      string(10) "<required>"
+    }
+  }
+}
+int(1)


Property changes on: php/php-src/trunk/Zend/tests/call_user_func_005.phpt
___________________________________________________________________
Added: svn:keywords
   + Id Rev Revision
Added: svn:eol-style
   + native

Added: php/php-src/trunk/Zend/tests/closure_035.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/closure_035.phpt                               
(rev 0)
+++ php/php-src/trunk/Zend/tests/closure_035.phpt       2009-12-20 22:04:55 UTC 
(rev 292379)
@@ -0,0 +1,31 @@
+--TEST--
+Testing recursion detection with Closures
+--FILE--
+<?php
+
+$x = function () use (&$x) {
+       $h = function () use ($x) {
+               var_dump($x);
+               return 1;
+       };
+       return $h();
+};
+
+var_dump($x());
+
+?>
+--EXPECTF--
+object(Closure)#%d (1) {
+  ["static"]=>
+  array(1) {
+    [%u|b%"x"]=>
+    &object(Closure)#%d (1) {
+      ["static"]=>
+      array(1) {
+        [%u|b%"x"]=>
+        *RECURSION*
+      }
+    }
+  }
+}
+int(1)


Property changes on: php/php-src/trunk/Zend/tests/closure_035.phpt
___________________________________________________________________
Added: svn:keywords
   + Id Rev Revision
Added: svn:eol-style
   + native

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to