diff options
Diffstat (limited to 'ext/zip/tests/oo_addglob.phpt')
-rw-r--r-- | ext/zip/tests/oo_addglob.phpt | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/ext/zip/tests/oo_addglob.phpt b/ext/zip/tests/oo_addglob.phpt new file mode 100644 index 0000000000..970bfc7678 --- /dev/null +++ b/ext/zip/tests/oo_addglob.phpt @@ -0,0 +1,50 @@ +--TEST-- +ZipArchive::addGlob() method +--CREDITS-- +Sammy Kaye Powers <sammyk@sammykmedia.com> +w/Kenzo over the shoulder +#phptek Chicago 2014 +--SKIPIF-- +<?php +/* $Id$ */ +if(!extension_loaded('zip')) die('skip'); +?> +--FILE-- +<?php +$dirname = dirname(__FILE__) . '/'; +include $dirname . 'utils.inc'; +$file = $dirname . '__tmp_oo_addglob.zip'; + +copy($dirname . 'test.zip', $file); +touch($dirname . 'foo.txt'); +touch($dirname . 'bar.baz'); + +$zip = new ZipArchive(); +if (!$zip->open($file)) { + exit('failed'); +} +$options = array('add_path' => 'baz/', 'remove_all_path' => TRUE); +if (!$zip->addGlob($dirname . '*.{txt,baz}', GLOB_BRACE, $options)) { + echo "failed1\n"; +} +if ($zip->status == ZIPARCHIVE::ER_OK) { + dump_entries_name($zip); + $zip->close(); +} else { + echo "failed2\n"; +} +?> +--CLEAN-- +<?php +$dirname = dirname(__FILE__) . '/'; +unlink($dirname . '__tmp_oo_addglob.zip'); +unlink($dirname . 'foo.txt'); +unlink($dirname . 'bar.baz'); +?> +--EXPECTF-- +0 bar +1 foobar/ +2 foobar/baz +3 entry1.txt +4 baz/foo.txt +5 baz/bar.baz |