Annotation of embedaddon/php/ext/phar/tests/zip/phar_setalias.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Phar::setAlias() zip-based
! 3: --SKIPIF--
! 4: <?php if (!extension_loaded("phar")) die("skip"); ?>
! 5: <?php if (!extension_loaded("zlib")) die("skip no zlib"); ?>
! 6: <?php if (!extension_loaded("bz2")) die("skip no bz2"); ?>
! 7: --INI--
! 8: phar.require_hash=0
! 9: phar.readonly=0
! 10: --FILE--
! 11: <?php
! 12:
! 13: $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.zip';
! 14: $fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '2.phar.zip';
! 15: $fname3 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '3.phar.zip';
! 16:
! 17: $phar = new Phar($fname);
! 18: $phar->setStub('<?php echo "first stub\n"; __HALT_COMPILER(); ?>');
! 19: $phar->setAlias('hio');
! 20:
! 21: $files = array();
! 22:
! 23: $files['a'] = 'a';
! 24: $files['b'] = 'b';
! 25: $files['c'] = 'c';
! 26:
! 27: foreach ($files as $n => $file) {
! 28: $phar[$n] = $file;
! 29: }
! 30: $phar->stopBuffering();
! 31:
! 32: echo $phar->getAlias() . "\n";
! 33: $phar->setAlias('test');
! 34: echo $phar->getAlias() . "\n";
! 35:
! 36: // test compression
! 37:
! 38: $phar->compressFiles(Phar::GZ);
! 39: copy($fname, $fname2);
! 40: $phar->setAlias('unused');
! 41: $p2 = new Phar($fname2);
! 42: echo $p2->getAlias(), "\n";
! 43: $p2->compressFiles(Phar::BZ2);
! 44: copy($fname2, $fname3);
! 45: $p2->setAlias('unused2');
! 46: $p3 = new Phar($fname3);
! 47: echo $p3->getAlias(), "\n";
! 48: ?>
! 49: ===DONE===
! 50: --CLEAN--
! 51: <?php
! 52: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.zip');
! 53: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '2.phar.zip');
! 54: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '3.phar.zip');
! 55: __HALT_COMPILER();
! 56: ?>
! 57: --EXPECT--
! 58: hio
! 59: test
! 60: test
! 61: test
! 62: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>