com php-src: Added basic test for ZipArchive::unchangeName(): ext/zip/tests/oo_unchangeName.phpt

From: Date: Sat, 09 Feb 2019 15:33:43 +0000
Subject: com php-src: Added basic test for ZipArchive::unchangeName(): ext/zip/tests/oo_unchangeName.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-104500@lists.php.net to get a copy of this message
Commit: 1227284fb5fdf31fa1ff654434a0bf50918f009c Author: Florian Engelhardt <flo@dotbox.org> Sat, 16 Sep 2017 22:42:13 +0200 Committer: Peter Kokot <peterkokot@gmail.com> Sat, 9 Feb 2019 16:33:43 +0100 Parents: ec814c3a624f38157f110de3ebaaa1917c2e6315 Branches: PHP-7.4 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1227284fb5fdf31fa1ff654434a0bf50918f009c Log: Added basic test for ZipArchive::unchangeName() Changed paths: A ext/zip/tests/oo_unchangeName.phpt Diff: diff --git a/ext/zip/tests/oo_unchangeName.phpt b/ext/zip/tests/oo_unchangeName.phpt new file mode 100644 index 0000000..3e16980 --- /dev/null +++ b/ext/zip/tests/oo_unchangeName.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test basic ZipArchive::unchangeName() 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->unchangeName('baz filename'); + +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"

« previous php.cvs (#104500) next »