File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / zip / tests / oo_addfile.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:48:05 2012 UTC (12 years, 6 months ago) by misho
Branches: php, MAIN
CVS tags: v5_3_10, HEAD
php

--TEST--
ziparchive::addFile() function
--SKIPIF--
<?php
/* $Id: oo_addfile.phpt,v 1.1.1.1 2012/02/21 23:48:05 misho Exp $ */
if(!extension_loaded('zip')) die('skip');
?>
--FILE--
<?php

$dirname = dirname(__FILE__) . '/';
include $dirname . 'utils.inc';
$file = $dirname . '__tmp_oo_addfile.zip';

copy($dirname . 'test.zip', $file);

$zip = new ZipArchive;
if (!$zip->open($file)) {
	exit('failed');
}
if (!$zip->addFile($dirname . 'utils.inc', 'test.php')) {
	echo "failed\n";
}
if ($zip->status == ZIPARCHIVE::ER_OK) {
	dump_entries_name($zip);
	$zip->close();
} else {
	echo "failed\n";
}
@unlink($file);
?>
--EXPECTF--
0 bar
1 foobar/
2 foobar/baz
3 entry1.txt
4 test.php

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>