-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added basic test for ZipArchive::unchangeIndex()
- Loading branch information
1 parent
2ca3bec
commit ec814c3
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |