summaryrefslogtreecommitdiff
path: root/ext/zlib/tests/gzopen_basic2.phpt
diff options
context:
space:
mode:
authorDave Kelsey <dkelsey@php.net>2009-01-19 14:03:08 +0000
committerDave Kelsey <dkelsey@php.net>2009-01-19 14:03:08 +0000
commit8f9ec4238fa879ab7bc4adb5c42a222b929c3b60 (patch)
treea5c6e17e512963f68d6933ceebca218b55a26487 /ext/zlib/tests/gzopen_basic2.phpt
parent357ed77aeaeaf45885d372b061b67110fe04dc76 (diff)
downloadphp-git-8f9ec4238fa879ab7bc4adb5c42a222b929c3b60.tar.gz
new tests for zlib extension, tested on windows, linux and linux64
Diffstat (limited to 'ext/zlib/tests/gzopen_basic2.phpt')
-rw-r--r--ext/zlib/tests/gzopen_basic2.phpt52
1 files changed, 52 insertions, 0 deletions
diff --git a/ext/zlib/tests/gzopen_basic2.phpt b/ext/zlib/tests/gzopen_basic2.phpt
new file mode 100644
index 0000000000..5cc02cd182
--- /dev/null
+++ b/ext/zlib/tests/gzopen_basic2.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test gzopen() function : basic functionality for writing
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+/* Prototype : resource gzopen(string filename, string mode [, int use_include_path])
+ * Description: Open a .gz-file and return a .gz-file pointer
+ * Source code: ext/zlib/zlib.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gzopen() : basic functionality ***\n";
+
+
+// Initialise all required variables
+$filename = "temp.txt.gz";
+$modes = array('w', 'w+');
+$data = "This was the information that was written";
+
+foreach($modes as $mode) {
+ echo "testing mode -- $mode --\n";
+ $h = gzopen($filename, $mode);
+ if ($h !== false) {
+ gzwrite($h, $data);
+ gzclose($h);
+ $h = gzopen($filename, 'r');
+ gzpassthru($h);
+ gzclose($h);
+ echo "\n";
+ unlink($filename);
+ }
+ else {
+ var_dump($h);
+ }
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gzopen() : basic functionality ***
+testing mode -- w --
+This was the information that was written
+testing mode -- w+ --
+
+Warning: gzopen(): cannot open a zlib stream for reading and writing at the same time! in %s on line %d
+bool(false)
+===DONE===