xref: /PHP-7.4/ext/zlib/tests/gzgets_basic.phpt (revision 26dfce7f)
1--TEST--
2Test function gzgets() by calling it with its expected arguments
3--SKIPIF--
4<?php
5if (!extension_loaded("zlib")) {
6	print "skip - ZLIB extension not loaded";
7}
8?>
9--FILE--
10<?php
11
12// note that gzgets is an alias to fgets. parameter checking tests will be
13// the same as fgets
14
15$f = __DIR__."/004.txt.gz";
16$h = gzopen($f, 'r');
17$lengths = array(10, 14, 7, 99);
18foreach ($lengths as $length) {
19   var_dump(gzgets( $h, $length ) );
20}
21
22while (gzeof($h) === false) {
23   var_dump(gzgets($h));
24}
25gzclose($h);
26
27
28?>
29===DONE===
30--EXPECT--
31string(9) "When you'"
32string(13) "re taught thr"
33string(6) "ough f"
34string(8) "eelings
35"
36string(26) "Destiny flying high above
37"
38string(38) "all I know is that you can realize it
39"
40string(18) "Destiny who cares
41"
42string(19) "as it turns around
43"
44string(39) "and I know that it descends down on me
45"
46===DONE===
47