php-src/ext/zip/tests/stream_meta_data.phpt
Felipe Pena b45066df97 - Fixed bug #53867 (Test failure)
patch by: rquadling at php.net
2011-01-28 20:41:54 +00:00

75 lines
1.2 KiB
PHP

--TEST--
stream_get_meta_data() on zip stream
--SKIPIF--
<?php
/* $Id: oo_stream.phpt 260091 2008-05-21 09:27:41Z pajoye $ */
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');
if(!$fp) exit("\n");
var_dump(stream_get_meta_data($fp));
fclose($fp);
$zip->close();
$fp = fopen('zip://' . dirname(__FILE__) . '/test_with_comment.zip#foo', 'rb');
if (!$fp) {
exit("cannot open\n");
}
var_dump(stream_get_meta_data($fp));
fclose($fp);
?>
--EXPECTF--
array(8) {
["stream_type"]=>
string(3) "zip"
["mode"]=>
string(2) "rb"
["unread_bytes"]=>
int(0)
["seekable"]=>
bool(false)
["uri"]=>
string(3) "foo"
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
array(9) {
["wrapper_type"]=>
string(11) "zip wrapper"
["stream_type"]=>
string(3) "zip"
["mode"]=>
string(2) "rb"
["unread_bytes"]=>
int(0)
["seekable"]=>
bool(false)
["uri"]=>
string(%d) "zip://%stest_with_comment.zip#foo"
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}