mirror of
https://github.com/php/php-src.git
synced 2025-08-20 09:24:05 +02:00
QA: Refactor: Split tests a bit to make them more comprehendable
This commit is contained in:
parent
ff66e59731
commit
7cd8ecb33f
2 changed files with 33 additions and 10 deletions
33
Zend/tests/methods-on-non-objects-nested-calls-dyn.phpt
Executable file
33
Zend/tests/methods-on-non-objects-nested-calls-dyn.phpt
Executable file
|
@ -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
|
|
@ -11,8 +11,6 @@ set_error_handler(function($code, $message) {
|
||||||
});
|
});
|
||||||
|
|
||||||
$x= null;
|
$x= null;
|
||||||
$ref= 'nested';
|
|
||||||
$func= function() { return nested(); };
|
|
||||||
var_dump($x->method(nested()));
|
var_dump($x->method(nested()));
|
||||||
var_dump($x->method(nested(), nested()));
|
var_dump($x->method(nested(), 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($x->deep())));
|
||||||
var_dump($x->method($x->nested(nested($x->deep()))));
|
var_dump($x->method($x->nested(nested($x->deep()))));
|
||||||
var_dump($x->method(nested(nested($x->nested()))));
|
var_dump($x->method(nested(nested($x->nested()))));
|
||||||
var_dump($x->method($ref()));
|
|
||||||
var_dump($x->method($func()));
|
|
||||||
echo "Alive\n";
|
echo "Alive\n";
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
|
@ -45,10 +41,4 @@ Called #8
|
||||||
NULL
|
NULL
|
||||||
Called #9
|
Called #9
|
||||||
NULL
|
NULL
|
||||||
Called #10
|
|
||||||
NULL
|
|
||||||
Called #11
|
|
||||||
NULL
|
|
||||||
Called #12
|
|
||||||
NULL
|
|
||||||
Alive
|
Alive
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue