gzwrite_basic.phpt 586 B

12345678910111213141516171819202122232425262728293031
  1. --TEST--
  2. Test function gzwrite() 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. $filename = "gzwrite_basic.txt.gz";
  12. $h = gzopen($filename, 'w');
  13. $str = "Here is the string to be written. ";
  14. $length = 10;
  15. var_dump(gzwrite( $h, $str ) );
  16. var_dump(gzwrite( $h, $str, $length ) );
  17. gzclose($h);
  18. $h = gzopen($filename, 'r');
  19. gzpassthru($h);
  20. gzclose($h);
  21. echo "\n";
  22. unlink($filename);
  23. ?>
  24. ===DONE===
  25. --EXPECT--
  26. int(34)
  27. int(10)
  28. Here is the string to be written. Here is th
  29. ===DONE===