xref: /PHP-7.0/ext/zlib/tests/gzeof_basic.phpt (revision 8f9ec423)
1--TEST--
2Test function feof() 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// note that gzeof is an alias to gzeof. parameter checking tests will be
12// the same as gzeof
13
14$f = dirname(__FILE__)."/004.txt.gz";
15
16echo "-- test 1 --\n";
17$h = gzopen($f, 'r');
18var_dump(gzeof($h));
19gzpassthru($h);
20var_dump(gzeof($h));
21gzclose($h);
22
23echo "\n-- test 2 --\n";
24$h = gzopen($f, 'r');
25echo "reading 50 characters. eof should be false\n";
26gzread($h, 50)."\n";
27var_dump(gzeof($h));
28echo "reading 250 characters. eof should be true\n";
29gzread($h, 250)."\n";
30var_dump(gzeof($h));
31echo "reading 20 characters. eof should be true still\n";
32gzread($h, 20)."\n";
33var_dump(gzeof($h));
34gzclose($h);
35
36
37
38?>
39===DONE===
40--EXPECT--
41-- test 1 --
42bool(false)
43When you're taught through feelings
44Destiny flying high above
45all I know is that you can realize it
46Destiny who cares
47as it turns around
48and I know that it descends down on me
49bool(true)
50
51-- test 2 --
52reading 50 characters. eof should be false
53bool(false)
54reading 250 characters. eof should be true
55bool(true)
56reading 20 characters. eof should be true still
57bool(true)
58===DONE===