Annotation of embedaddon/php/ext/zip/tests/oo_rename.phpt, revision 1.1.1.2

1.1       misho       1: --TEST--
                      2: Rename entries
                      3: --SKIPIF--
                      4: <?php
1.1.1.2 ! misho       5: /* $Id$ */
1.1       misho       6: if(!extension_loaded('zip')) die('skip');
                      7: ?>
                      8: --FILE--
                      9: <?php
                     10: $dirname = dirname(__FILE__) . '/';
                     11: include $dirname . 'utils.inc';
                     12: $file = $dirname . '__tmp_oo_rename.zip';
                     13: 
                     14: @unlink($file);
                     15: 
                     16: $zip = new ZipArchive;
                     17: if (!$zip->open($file, ZIPARCHIVE::CREATE)) {
                     18:        exit('failed');
                     19: }
                     20: 
                     21: $zip->addFromString('entry1.txt', 'entry #1');
                     22: $zip->addFromString('entry2.txt', 'entry #2');
                     23: $zip->addFromString('dir/entry2.txt', 'entry #2');
                     24: 
                     25: if (!$zip->status == ZIPARCHIVE::ER_OK) {
                     26:        var_dump($zip);
                     27:        echo "failed\n";
                     28: }
                     29: 
                     30: $zip->close();
                     31: 
                     32: if (!$zip->open($file)) {
                     33:        exit('failed');
                     34: }
                     35: 
                     36: dump_entries_name($zip);
                     37: echo "\n";
                     38: 
                     39: if (!$zip->renameIndex(0, 'ren_entry1.txt')) {
                     40:        echo "failed index 0\n";
                     41: }
                     42: 
                     43: if (!$zip->renameName('dir/entry2.txt', 'dir3/ren_entry2.txt')) {
                     44:        echo "failed name dir/entry2.txt\n";
                     45: }
                     46: dump_entries_name($zip);
                     47: $zip->close();
                     48: 
                     49: @unlink($file);
                     50: ?>
                     51: --EXPECTF--
                     52: 0 entry1.txt
                     53: 1 entry2.txt
                     54: 2 dir/entry2.txt
                     55: 
                     56: 0 ren_entry1.txt
                     57: 1 entry2.txt
                     58: 2 dir3/ren_entry2.txt

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>