summaryrefslogtreecommitdiff
path: root/ext/zip/tests/oo_stream.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/zip/tests/oo_stream.phpt')
-rw-r--r--ext/zip/tests/oo_stream.phpt50
1 files changed, 50 insertions, 0 deletions
diff --git a/ext/zip/tests/oo_stream.phpt b/ext/zip/tests/oo_stream.phpt
new file mode 100644
index 0000000..126e78f
--- /dev/null
+++ b/ext/zip/tests/oo_stream.phpt
@@ -0,0 +1,50 @@
+--TEST--
+getStream
+--SKIPIF--
+<?php
+/* $Id$ */
+if(!extension_loaded('zip')) die('skip');
+?>
+--FILE--
+<?php
+$dirname = dirname(__FILE__) . '/';
+$file = $dirname . 'test_with_comment.zip';
+include $dirname . 'utils.inc';
+$zip = new ZipArchive;
+if (!$zip->open($file)) {
+ exit('failed');
+}
+$fp = $zip->getStream('foo');
+
+var_dump($fp);
+if(!$fp) exit("\n");
+$contents = '';
+while (!feof($fp)) {
+ $contents .= fread($fp, 255);
+}
+
+fclose($fp);
+$zip->close();
+var_dump($contents);
+
+
+$fp = fopen('zip://' . dirname(__FILE__) . '/test_with_comment.zip#foo', 'rb');
+if (!$fp) {
+ exit("cannot open\n");
+}
+$contents = '';
+while (!feof($fp)) {
+ $contents .= fread($fp, 2);
+}
+var_dump($contents);
+fclose($fp);
+
+?>
+--EXPECTF--
+resource(%d) of type (stream)
+string(5) "foo
+
+"
+string(5) "foo
+
+"