Annotation of embedaddon/php/ext/zip/tests/oo_stream.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: getStream
! 3: --SKIPIF--
! 4: <?php
! 5: /* $Id: oo_stream.phpt 260091 2008-05-21 09:27:41Z pajoye $ */
! 6: if(!extension_loaded('zip')) die('skip');
! 7: ?>
! 8: --FILE--
! 9: <?php
! 10: $dirname = dirname(__FILE__) . '/';
! 11: $file = $dirname . 'test_with_comment.zip';
! 12: include $dirname . 'utils.inc';
! 13: $zip = new ZipArchive;
! 14: if (!$zip->open($file)) {
! 15: exit('failed');
! 16: }
! 17: $fp = $zip->getStream('foo');
! 18:
! 19: var_dump($fp);
! 20: if(!$fp) exit("\n");
! 21: $contents = '';
! 22: while (!feof($fp)) {
! 23: $contents .= fread($fp, 255);
! 24: }
! 25:
! 26: fclose($fp);
! 27: $zip->close();
! 28: var_dump($contents);
! 29:
! 30:
! 31: $fp = fopen('zip://' . dirname(__FILE__) . '/test_with_comment.zip#foo', 'rb');
! 32: if (!$fp) {
! 33: exit("cannot open\n");
! 34: }
! 35: $contents = '';
! 36: while (!feof($fp)) {
! 37: $contents .= fread($fp, 2);
! 38: }
! 39: var_dump($contents);
! 40: fclose($fp);
! 41:
! 42: ?>
! 43: --EXPECTF--
! 44: resource(%d) of type (stream)
! 45: string(5) "foo
! 46:
! 47: "
! 48: string(5) "foo
! 49:
! 50: "
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>