gzgets_basic.phpt 857 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. --TEST--
  2. Test function gzgets() 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 gzgets is an alias to fgets. parameter checking tests will be
  12. // the same as fgets
  13. $f = dirname(__FILE__)."/004.txt.gz";
  14. $h = gzopen($f, 'r');
  15. $lengths = array(10, 14, 7, 99);
  16. foreach ($lengths as $length) {
  17. var_dump(gzgets( $h, $length ) );
  18. }
  19. while (gzeof($h) === false) {
  20. var_dump(gzgets($h));
  21. }
  22. gzclose($h);
  23. ?>
  24. ===DONE===
  25. --EXPECT--
  26. string(9) "When you'"
  27. string(13) "re taught thr"
  28. string(6) "ough f"
  29. string(8) "eelings
  30. "
  31. string(26) "Destiny flying high above
  32. "
  33. string(38) "all I know is that you can realize it
  34. "
  35. string(18) "Destiny who cares
  36. "
  37. string(19) "as it turns around
  38. "
  39. string(39) "and I know that it descends down on me
  40. "
  41. ===DONE===