zlib_scheme_copy_basic.phpt 763 B

12345678910111213141516171819202122232425262728293031323334353637
  1. --TEST--
  2. Test compress.zlib:// scheme with the copy function: compressed to compressed
  3. --SKIPIF--
  4. <?php
  5. if (!extension_loaded("zlib")) {
  6. print "skip - ZLIB extension not loaded";
  7. }
  8. ?>
  9. --FILE--
  10. <?php
  11. $inputFileName = dirname(__FILE__)."/004.txt.gz";
  12. $outputFileName = __FILE__.'.tmp';
  13. $srcFile = "compress.zlib://$inputFileName";
  14. $destFile = "compress.zlib://$outputFileName";
  15. copy($srcFile, $destFile);
  16. $h = gzopen($inputFileName, 'r');
  17. $org_data = gzread($h, 4096);
  18. gzclose($h);
  19. $h = gzopen($outputFileName, 'r');
  20. $copied_data = gzread($h, 4096);
  21. gzclose($h);
  22. if ($org_data == $copied_data) {
  23. echo "OK: Copy identical\n";
  24. }
  25. else {
  26. echo "FAILED: Copy not identical";
  27. }
  28. unlink($outputFileName);
  29. ?>
  30. ===DONE===
  31. --EXPECT--
  32. OK: Copy identical
  33. ===DONE===