Skip to content

Commit 2cf2ae1

Browse files
committed
Improve tests
1 parent 3fc7f7f commit 2cf2ae1

File tree

7 files changed

+18
-21
lines changed

7 files changed

+18
-21
lines changed

Zend/tests/partial_application/references_002.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function foo($a, &$b) {
77
$b = 2;
88
}
99

10-
$a = [];
10+
$a = ['this will be changed'];
1111
$b = &$a[0];
1212

1313
$foo = foo(1, ?);

Zend/tests/partial_application/rfc_examples_debug.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function g() {
1212
}
1313

1414
$f = f(?, ?, 3);
15-
$f(1,2);
15+
$f(1, 2);
1616

1717
?>
1818
--EXPECTF--

Zend/tests/partial_application/statics_001.phpt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@ function foo($a) {
1010
return $var;
1111
}
1212

13-
foo(new stdClass);
13+
var_dump(foo(new stdClass));
1414

1515
$foo = foo(new stdClass, ...);
1616

17-
if ($foo() == 2) {
18-
echo "OK";
19-
}
17+
var_dump($foo());
2018
?>
21-
--EXPECTF--
22-
OK
19+
--EXPECT--
20+
int(1)
21+
int(2)

Zend/tests/partial_application/statics_002.phpt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@ $closure = function ($a) {
1010
return $var;
1111
};
1212

13-
$closure(new stdClass);
13+
var_dump($closure(new stdClass));
1414

1515
$foo = $closure(new stdClass, ...);
1616
$closure = null;
1717

18-
if ($foo() == 2) {
19-
echo "OK";
20-
}
18+
var_dump($foo());
2119
?>
2220
--EXPECT--
23-
OK
21+
int(1)
22+
int(2)

Zend/tests/partial_application/statics_003.phpt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,16 @@ $closure = function ($a) {
1010
return $var;
1111
};
1212

13-
$closure(new stdClass);
13+
var_dump($closure(new stdClass));
1414

1515
$foo = $closure(?);
1616
$closure = null;
1717

1818
$bar = $foo(?);
1919
$foo = null;
2020

21-
if ($bar(new stdClass) == 2) {
22-
echo "OK";
23-
}
21+
var_dump($bar(new stdClass));
2422
?>
2523
--EXPECT--
26-
OK
24+
int(1)
25+
int(2)

Zend/tests/partial_application/variation_ex_001.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ PFA variation: UAF in cleanup unfinished calls
55
function test($a){}
66

77
try {
8-
test(1,...)(?);
8+
test(1, ...)(?);
99
} catch (Error $ex) {
1010
echo $ex::class, ": ", $ex->getMessage(), "\n";
1111
}

Zend/tests/partial_application/variation_invoke_001.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function foo($a, $b) {
88

99
$foo = foo(b: 10, ...);
1010

11-
var_dump($foo->__invoke(32) == 42);
11+
var_dump($foo->__invoke(32));
1212

1313
try {
1414
$foo->nothing();
@@ -17,5 +17,5 @@ try {
1717
}
1818
?>
1919
--EXPECT--
20-
bool(true)
20+
int(42)
2121
Error: Call to undefined method Closure::nothing()

0 commit comments

Comments
 (0)