Annotation of embedaddon/php/ext/phar/tests/zip/phar_copy.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Phar: copy() zip-based
! 3: --SKIPIF--
! 4: <?php if (!extension_loaded("phar")) die("skip"); ?>
! 5: <?php if (!extension_loaded("spl")) die("skip SPL not available"); ?>
! 6: --INI--
! 7: phar.readonly=0
! 8: phar.require_hash=1
! 9: --FILE--
! 10: <?php
! 11:
! 12: $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.zip.php';
! 13: $fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '2.phar.php';
! 14:
! 15: $pname = 'phar://'.$fname;
! 16: $iname = '/file.txt';
! 17: $ename = '/error/..';
! 18:
! 19: $p = new Phar($fname);
! 20:
! 21: try
! 22: {
! 23: $p['a'] = 'hi';
! 24: $p->startBuffering();
! 25: $p->copy('a', 'b');
! 26: echo file_get_contents($p['b']->getPathName());
! 27: $p->copy('b', 'c');
! 28: $p->stopBuffering();
! 29: echo file_get_contents($p['c']->getPathName());
! 30: copy($fname, $fname2);
! 31: var_dump($p->isFileFormat(Phar::ZIP));
! 32: $p->copy('a', $ename);
! 33: }
! 34: catch(Exception $e)
! 35: {
! 36: echo $e->getMessage() . "\n";
! 37: }
! 38: ini_set('phar.readonly',1);
! 39: $p2 = new Phar($fname2);
! 40: var_dump($p2->isFileFormat(Phar::ZIP));
! 41: echo "\n";
! 42: echo 'a: ' , file_get_contents($p2['a']->getPathName());
! 43: echo 'b: ' ,file_get_contents($p2['b']->getPathName());
! 44: echo 'c: ' ,file_get_contents($p2['c']->getPathName());
! 45: ?>
! 46: ===DONE===
! 47: --CLEAN--
! 48: <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.zip.php'); ?>
! 49: <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '2.phar.php'); ?>
! 50: --EXPECTF--
! 51: hihibool(true)
! 52: file "/error/.." contains invalid characters upper directory reference, cannot be copied from "a" in phar %s
! 53: bool(true)
! 54:
! 55: a: hib: hic: hi===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>