summaryrefslogtreecommitdiff
path: root/ext/zip/tests
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2014-05-26 10:52:43 +0400
committerDmitry Stogov <dmitry@zend.com>2014-05-26 10:52:43 +0400
commit9dd66e4d537073ea311929a65622d898193618c8 (patch)
treec1a205487d4156c439d1b4f8e8e9f82b425fa9eb /ext/zip/tests
parent066c1d5451a33c652e23a59e6455dca331007919 (diff)
parent347b430a03a394f31048ad16b2bbc22e29f3baf5 (diff)
downloadphp-git-9dd66e4d537073ea311929a65622d898193618c8.tar.gz
Merge branch 'master' into phpng
* master: Fixed issue #183 (TMP_VAR is not only used once) Fix broken Junit output with --disable-cgi Added folder mark Further test fixes for the fdb2709 breakage. Fix broken test caused by fdb2709. Added tests for ZipArchive::addGlob() and ZipArchive::addPattern() Fix run-tests.php with Valgrind >= 3.10.0. Add microseconds to the serialised form of DateTime objects. Improved test for bug #62479 fix typo in ODBC code gcov: tentative fix for broken coverage data after fix for opcache coverage slightly hackish, but works. The idea is that we want to give priority to .gcda files in .libs dirs vs the files in the upper level dir 5.5.14 now Fix bug #67060: use default mode of 660 Conflicts: ext/date/php_date.c
Diffstat (limited to 'ext/zip/tests')
-rw-r--r--ext/zip/tests/oo_addglob.phpt50
-rw-r--r--ext/zip/tests/oo_addpattern.phpt51
2 files changed, 101 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
diff --git a/ext/zip/tests/oo_addpattern.phpt b/ext/zip/tests/oo_addpattern.phpt
new file mode 100644
index 0000000000..4e1cab4ad9
--- /dev/null
+++ b/ext/zip/tests/oo_addpattern.phpt
@@ -0,0 +1,51 @@
+--TEST--
+ZipArchive::addPattern() 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_addpattern.zip';
+
+copy($dirname . 'test.zip', $file);
+touch($dirname . 'foo.txt');
+touch($dirname . 'bar.txt');
+
+$zip = new ZipArchive();
+if (!$zip->open($file)) {
+ exit('failed');
+}
+$dir = realpath($dirname);
+$options = array('add_path' => 'baz/', 'remove_path' => $dir);
+if (!$zip->addPattern('/\.txt$/', $dir, $options)) {
+ echo "failed\n";
+}
+if ($zip->status == ZIPARCHIVE::ER_OK) {
+ dump_entries_name($zip);
+ $zip->close();
+} else {
+ echo "failed\n";
+}
+?>
+--CLEAN--
+<?php
+$dirname = dirname(__FILE__) . '/';
+unlink($dirname . '__tmp_oo_addpattern.zip');
+unlink($dirname . 'foo.txt');
+unlink($dirname . 'bar.txt');
+?>
+--EXPECTF--
+0 bar
+1 foobar/
+2 foobar/baz
+3 entry1.txt
+4 baz/bar.txt
+5 baz/foo.txt