com php-src: QA: Refactor: Split tests a bit to make them more comprehendable: Zend/tests/methods-on-non-objects-nested-calls-dyn.phpt
Zend/tests/methods-on-non-objects-nested-calls.phpt

From: Date: Sun, 06 Jul 2014 13:05:47 +0000
Subject: com php-src: QA: Refactor: Split tests a bit to make them more comprehendable: Zend/tests/methods-on-non-objects-nested-calls-dyn.phpt
Zend/tests/methods-on-non-objects-nested-calls.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-82143@lists.php.net to get a copy of this message
Commit: 7cd8ecb33f74a4042238fb821ff18a154b03d1d3 Author: Timm Friebe <thekid@thekid.de> Sun, 6 Jul 2014 15:05:47 +0200 Parents: ff66e597314f39e7015fb7c238c29d8f6e02dcab Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7cd8ecb33f74a4042238fb821ff18a154b03d1d3 Log: QA: Refactor: Split tests a bit to make them more comprehendable Changed paths: A Zend/tests/methods-on-non-objects-nested-calls-dyn.phpt M Zend/tests/methods-on-non-objects-nested-calls.phpt Diff: diff --git a/Zend/tests/methods-on-non-objects-nested-calls-dyn.phpt b/Zend/tests/methods-on-non-objects-nested-calls-dyn.phpt new file mode 100755 index 0000000..56819e0 --- /dev/null +++ b/Zend/tests/methods-on-non-objects-nested-calls-dyn.phpt @@ -0,0 +1,33 @@ +--TEST-- +Catch method calls on non-objects with nested dynamic calls +--FILE-- +<?php +function nested() { + throw new LogicException('Should not be called'); +} +set_error_handler(function($code, $message) { + static $i= 0; + echo 'Called #'.(++$i)."\n"; +}); + +$x= null; + +$closure= function() { return nested(); }; +var_dump($x->method($closure())); + +$lambda= create_function('', 'return nested();'); +var_dump($x->method($lambda())); + +$func= 'nested'; +var_dump($x->method($func())); + +echo "Alive\n"; +?> +--EXPECTF-- +Called #1 +NULL +Called #2 +NULL +Called #3 +NULL +Alive diff --git a/Zend/tests/methods-on-non-objects-nested-calls.phpt b/Zend/tests/methods-on-non-objects-nested-calls.phpt index c92b0cb..e1fee51 100644 --- a/Zend/tests/methods-on-non-objects-nested-calls.phpt +++ b/Zend/tests/methods-on-non-objects-nested-calls.phpt @@ -11,8 +11,6 @@ set_error_handler(function($code, $message) { }); $x= null; -$ref= 'nested'; -$func= function() { return nested(); }; var_dump($x->method(nested())); var_dump($x->method(nested(), nested())); var_dump($x->method(nested(nested()))); @@ -22,8 +20,6 @@ var_dump($x->method($x->nested(nested()))); var_dump($x->method($x->nested($x->deep()))); var_dump($x->method($x->nested(nested($x->deep())))); var_dump($x->method(nested(nested($x->nested())))); -var_dump($x->method($ref())); -var_dump($x->method($func())); echo "Alive\n"; ?> --EXPECTF-- @@ -45,10 +41,4 @@ Called #8 NULL Called #9 NULL -Called #10 -NULL -Called #11 -NULL -Called #12 -NULL Alive

« previous php.cvs (#82143) next »