gzgets_basic.phpt 747 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. --TEST--
  2. Test function gzgets() by calling it with its expected arguments
  3. --EXTENSIONS--
  4. zlib
  5. --FILE--
  6. <?php
  7. // note that gzgets is an alias to fgets. parameter checking tests will be
  8. // the same as fgets
  9. $f = __DIR__."/004.txt.gz";
  10. $h = gzopen($f, 'r');
  11. $lengths = array(10, 14, 7, 99);
  12. foreach ($lengths as $length) {
  13. var_dump(gzgets( $h, $length ) );
  14. }
  15. while (gzeof($h) === false) {
  16. var_dump(gzgets($h));
  17. }
  18. gzclose($h);
  19. ?>
  20. --EXPECT--
  21. string(9) "When you'"
  22. string(13) "re taught thr"
  23. string(6) "ough f"
  24. string(8) "eelings
  25. "
  26. string(26) "Destiny flying high above
  27. "
  28. string(38) "all I know is that you can realize it
  29. "
  30. string(18) "Destiny who cares
  31. "
  32. string(19) "as it turns around
  33. "
  34. string(39) "and I know that it descends down on me
  35. "