xref: /PHP-8.0/ext/zlib/tests/gzgets_basic.phpt (revision c5401854)
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--EXPECT--
30string(9) "When you'"
31string(13) "re taught thr"
32string(6) "ough f"
33string(8) "eelings
34"
35string(26) "Destiny flying high above
36"
37string(38) "all I know is that you can realize it
38"
39string(18) "Destiny who cares
40"
41string(19) "as it turns around
42"
43string(39) "and I know that it descends down on me
44"
45