com php-src: Added basic test for ZipArchive::unchangeIndex(): ext/zip/tests/oo_unchangeIndex.phpt
| From: | Peter Kokot | Date: | Sat, 09 Feb 2019 15:27:30 +0000 |
| Subject: | com php-src: Added basic test for ZipArchive::unchangeIndex(): ext/zip/tests/oo_unchangeIndex.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-104499@lists.php.net to get a copy of this message | ||
Commit: ec814c3a624f38157f110de3ebaaa1917c2e6315
Author: Florian Engelhardt <flo@dotbox.org> Sat, 16 Sep 2017 22:31:08 +0200
Committer: Peter Kokot <peterkokot@gmail.com> Sat, 9 Feb 2019 16:27:30 +0100
Parents: 2ca3becd174b264b7367b510483b78e84f253295
Branches: PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ec814c3a624f38157f110de3ebaaa1917c2e6315
Log:
Added basic test for ZipArchive::unchangeIndex()
Changed paths:
A ext/zip/tests/oo_unchangeIndex.phpt
Diff:
diff --git a/ext/zip/tests/oo_unchangeIndex.phpt b/ext/zip/tests/oo_unchangeIndex.phpt
new file mode 100644
index 0000000..eabb53c
--- /dev/null
+++ b/ext/zip/tests/oo_unchangeIndex..phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test basic ZipArchive::unchangeIndex() Method
+--CREDITS--
+PHP TestFest 2017 - Bergfreunde, Florian Engelhardt
+--SKIPIF--
+<?php if (!extension_loaded("zip")) print "skip"; ?>
+--FILE--
+<?php
+$dirname = dirname(__FILE__) . '/';
+$file = $dirname . '__tmp_oo_unchangeIndex.zip';
+copy($dirname.'test.zip', $file);
+
+var_dump(md5_file($file));
+
+$zip = new ZipArchive();
+$zip->open($file);
+var_dump($zip->getNameIndex(0));
+var_dump($zip->getCommentIndex(0));
+
+$zip->renameIndex(0, 'baz filename');
+$zip->setCommentIndex(0, 'baz comment');
+
+var_dump($zip->getNameIndex(0));
+var_dump($zip->getCommentIndex(0));
+
+$zip->unchangeIndex(0);
+
+var_dump($zip->getNameIndex(0));
+var_dump($zip->getCommentIndex(0));
+
+var_dump(md5_file($file));
+
+unlink($file);
+?>
+--EXPECT--
+string(32) "cb753d0a812b2edb386bdcbc4cd7d131"
+string(3) "bar"
+string(0) ""
+string(12) "baz filename"
+string(11) "baz comment"
+string(3) "bar"
+string(0) ""
+string(32) "cb753d0a812b2edb386bdcbc4cd7d131"