Annotation of embedaddon/php/ext/zip/tests/oo_getnameindex.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: getNameIndex
        !             3: --SKIPIF--
        !             4: <?php
        !             5: /* $Id: oo_getnameindex.phpt 260091 2008-05-21 09:27:41Z pajoye $ */
        !             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/entry2d.txt', 'entry #2');
        !            24: 
        !            25: if (!$zip->status == ZIPARCHIVE::ER_OK) {
        !            26:        echo "failed to write zip\n";
        !            27: }
        !            28: $zip->close();
        !            29: 
        !            30: if (!$zip->open($file)) {
        !            31:        exit('failed');
        !            32: }
        !            33: 
        !            34: 
        !            35: var_dump($zip->getNameIndex(0));
        !            36: var_dump($zip->getNameIndex(1));
        !            37: var_dump($zip->getNameIndex(2));
        !            38: var_dump($zip->getNameIndex(3));
        !            39: 
        !            40: $zip->close();
        !            41: 
        !            42: ?>
        !            43: --EXPECTF--
        !            44: string(10) "entry1.txt"
        !            45: string(10) "entry2.txt"
        !            46: string(15) "dir/entry2d.txt"
        !            47: bool(false)

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