Annotation of embedaddon/php/ext/phar/tests/tar/alias_acrobatics.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Phar: alias edge cases
! 3: --SKIPIF--
! 4: <?php if (!extension_loaded("phar")) die("skip"); ?>
! 5: --INI--
! 6: phar.readonly=0
! 7: --FILE--
! 8: <?php
! 9:
! 10: $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar';
! 11: $fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.phar.tar';
! 12:
! 13: $p = new Phar($fname);
! 14:
! 15: $p->setAlias('foo');
! 16: $p['unused'] = 'hi';
! 17: try {
! 18: $a = new Phar($fname2, 0, 'foo');
! 19: } catch (Exception $e) {
! 20: echo $e->getMessage(),"\n";
! 21: }
! 22: copy($fname, $fname2);
! 23: echo "2\n";
! 24: try {
! 25: $a = new Phar($fname2);
! 26: } catch (Exception $e) {
! 27: echo $e->getMessage(),"\n";
! 28: }
! 29: try {
! 30: $b = new Phar($fname, 0, 'another');
! 31: } catch (Exception $e) {
! 32: echo $e->getMessage(),"\n";
! 33: }
! 34: ?>
! 35: ===DONE===
! 36: --CLEAN--
! 37: <?php
! 38: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar');
! 39: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.2.phar.tar');
! 40: ?>
! 41: --EXPECTF--
! 42: alias "foo" is already used for archive "%salias_acrobatics.phar.tar" cannot be overloaded with "%salias_acrobatics.2.phar.tar"
! 43: 2
! 44: phar error: Unable to add tar-based phar "%salias_acrobatics.2.phar.tar", alias is already in use
! 45: alias "another" is already used for archive "%salias_acrobatics.phar.tar" cannot be overloaded with "%salias_acrobatics.phar.tar"
! 46: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>