Skip to content

Commit b06bea7

Browse files
committed
Use variety types in test
1 parent b1340dd commit b06bea7

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

ext/zlib/tests/deflate_init_strategy_type_error.phpt

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ zlib
55
--FILE--
66
<?php
77

8+
class A {}
9+
$fp = fopen('php://memory', 'r');
10+
811
try {
9-
deflate_init(ZLIB_ENCODING_DEFLATE, ['level' => []]);
12+
deflate_init(ZLIB_ENCODING_DEFLATE, ['level' => 'foo']);
1013
} catch (TypeError $e) {
1114
echo $e->getMessage(), PHP_EOL;
1215
}
@@ -18,20 +21,22 @@ try {
1821
}
1922

2023
try {
21-
deflate_init(ZLIB_ENCODING_DEFLATE, ['window' => []]);
24+
deflate_init(ZLIB_ENCODING_DEFLATE, ['window' => new A()]);
2225
} catch (TypeError $e) {
2326
echo $e->getMessage(), PHP_EOL;
2427
}
2528

2629
try {
27-
deflate_init(ZLIB_ENCODING_DEFLATE, ['strategy' => []]);
30+
deflate_init(ZLIB_ENCODING_DEFLATE, ['strategy' => $fp]);
2831
} catch (TypeError $e) {
2932
echo $e->getMessage(), PHP_EOL;
3033
}
3134

35+
fclose($fp);
36+
3237
?>
3338
--EXPECT--
34-
deflate_init(): Argument #2 ($options) the value for option "level" must be of type int, array given
39+
deflate_init(): Argument #2 ($options) the value for option "level" must be of type int, string given
3540
deflate_init(): Argument #2 ($options) the value for option "memory" must be of type int, array given
36-
deflate_init(): Argument #2 ($options) the value for option "window" must be of type int, array given
37-
deflate_init(): Argument #2 ($options) the value for option "strategy" must be of type int, array given
41+
deflate_init(): Argument #2 ($options) the value for option "window" must be of type int, A given
42+
deflate_init(): Argument #2 ($options) the value for option "strategy" must be of type int, resource given

0 commit comments

Comments
 (0)