Annotation of embedaddon/php/ext/zlib/tests/zlib_scheme_copy_variation1.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test compress.zlib:// scheme with the copy function: compressed to uncompressed
! 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:
! 14: $srcFile = "compress.zlib://$inputFileName";
! 15: $destFile = $outputFileName;
! 16: copy($srcFile, $destFile);
! 17:
! 18: $h = gzopen($inputFileName, 'r');
! 19: $org_data = gzread($h, 4096);
! 20: gzclose($h);
! 21:
! 22: // can only read uncompressed data
! 23: $h = fopen($outputFileName, 'r');
! 24: $copied_data = fread($h, 4096);
! 25: gzclose($h);
! 26:
! 27: if ($org_data == $copied_data) {
! 28: echo "OK: Copy identical\n";
! 29: }
! 30: else {
! 31: echo "FAILED: Copy not identical";
! 32: }
! 33: unlink($outputFileName);
! 34: ?>
! 35: ===DONE===
! 36: --EXPECT--
! 37: OK: Copy identical
! 38: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>