summaryrefslogtreecommitdiff
path: root/ext/zlib/tests/gzseek_basic2.phpt
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2013-03-14 05:42:27 +0000
committer <>2013-04-03 16:25:08 +0000
commitc4dd7a1a684490673e25aaf4fabec5df138854c4 (patch)
tree4d57c44caae4480efff02b90b9be86f44bf25409 /ext/zlib/tests/gzseek_basic2.phpt
downloadphp2-master.tar.gz
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/zlib/tests/gzseek_basic2.phpt')
-rw-r--r--ext/zlib/tests/gzseek_basic2.phpt42
1 files changed, 42 insertions, 0 deletions
diff --git a/ext/zlib/tests/gzseek_basic2.phpt b/ext/zlib/tests/gzseek_basic2.phpt
new file mode 100644
index 0000000..a815b8f
--- /dev/null
+++ b/ext/zlib/tests/gzseek_basic2.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test function gzseek() by calling it with its expected arguments when writing
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+$f = "temp3.txt.gz";
+$h = gzopen($f, 'w');
+$str1 = "This is the first line.";
+$str2 = "This is the second line.";
+gzwrite($h, $str1);
+echo "tell=".gztell($h)."\n";
+
+//seek forwards 20 bytes.
+gzseek($h, strlen($str1) + 20);
+echo "tell=".gztell($h)."\n";
+gzwrite($h, $str2);
+echo "tell=".gztell($h)."\n";
+gzclose($h);
+echo "\nreading the output file\n";
+$h = gzopen($f, 'r');
+echo gzread($h, strlen($str1))."\n";
+echo var_dump(bin2hex(gzread($h, 20)));
+echo gzread($h, strlen($str2))."\n";
+gzclose($h);
+unlink($f);
+?>
+===DONE===
+--EXPECT--
+tell=23
+tell=43
+tell=67
+
+reading the output file
+This is the first line.
+string(40) "0000000000000000000000000000000000000000"
+This is the second line.
+===DONE=== \ No newline at end of file