xref: /PHP-5.3/ext/zip/tests/oo_addfile.phpt (revision 9d0f6426)
1--TEST--
2ziparchive::addFile() function
3--SKIPIF--
4<?php
5/* $Id$ */
6if(!extension_loaded('zip')) die('skip');
7?>
8--FILE--
9<?php
10
11$dirname = dirname(__FILE__) . '/';
12include $dirname . 'utils.inc';
13$file = $dirname . '__tmp_oo_addfile.zip';
14
15copy($dirname . 'test.zip', $file);
16
17$zip = new ZipArchive;
18if (!$zip->open($file)) {
19	exit('failed');
20}
21if (!$zip->addFile($dirname . 'utils.inc', 'test.php')) {
22	echo "failed\n";
23}
24if ($zip->status == ZIPARCHIVE::ER_OK) {
25	dump_entries_name($zip);
26	$zip->close();
27} else {
28	echo "failed\n";
29}
30@unlink($file);
31?>
32--EXPECTF--
330 bar
341 foobar/
352 foobar/baz
363 entry1.txt
374 test.php
38