gzeof_basic.phpt 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. --TEST--
  2. Test function feof() by calling it with its expected arguments
  3. --SKIPIF--
  4. <?php
  5. if (!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. $f = dirname(__FILE__)."/004.txt.gz";
  14. echo "-- test 1 --\n";
  15. $h = gzopen($f, 'r');
  16. var_dump(gzeof($h));
  17. gzpassthru($h);
  18. var_dump(gzeof($h));
  19. gzclose($h);
  20. echo "\n-- test 2 --\n";
  21. $h = gzopen($f, 'r');
  22. echo "reading 50 characters. eof should be false\n";
  23. gzread($h, 50)."\n";
  24. var_dump(gzeof($h));
  25. echo "reading 250 characters. eof should be true\n";
  26. gzread($h, 250)."\n";
  27. var_dump(gzeof($h));
  28. echo "reading 20 characters. eof should be true still\n";
  29. gzread($h, 20)."\n";
  30. var_dump(gzeof($h));
  31. gzclose($h);
  32. ?>
  33. ===DONE===
  34. --EXPECT--
  35. -- test 1 --
  36. bool(false)
  37. When you're taught through feelings
  38. Destiny flying high above
  39. all I know is that you can realize it
  40. Destiny who cares
  41. as it turns around
  42. and I know that it descends down on me
  43. bool(true)
  44. -- test 2 --
  45. reading 50 characters. eof should be false
  46. bool(false)
  47. reading 250 characters. eof should be true
  48. bool(true)
  49. reading 20 characters. eof should be true still
  50. bool(true)
  51. ===DONE===