Annotation of embedaddon/php/ext/phar/tests/test_unset.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Phar: ensure unset() works properly on a non-flushed phar archive
! 3: --SKIPIF--
! 4: <?php if (!extension_loaded("phar")) die("skip"); ?>
! 5: --INI--
! 6: phar.readonly=0
! 7: --FILE--
! 8: <?php
! 9: $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
! 10: $fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.phar.php';
! 11:
! 12: if (file_exists($fname)) unlink($fname);
! 13: if (file_exists($fname2)) unlink($fname2);
! 14:
! 15: $phar = new Phar($fname); // no entries, never flushed
! 16: $phar->setAlias('first');
! 17: $phar->setMetadata('hi');
! 18: unset($phar);
! 19:
! 20: $phar = new Phar($fname2);
! 21: $phar['b'] = 'whatever'; // flushed
! 22: try {
! 23: $phar->setAlias('first');
! 24: } catch(Exception $e) {
! 25: echo $e->getMessage()."\n";
! 26: }
! 27:
! 28: $phar = new Phar($fname);
! 29: var_dump($phar->getMetadata());
! 30: var_dump($phar->getAlias());
! 31: var_dump(file_exists($fname));
! 32:
! 33: ?>
! 34: ===DONE===
! 35: --CLEAN--
! 36: <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
! 37: <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.2.phar.php'); ?>
! 38: --EXPECTF--
! 39: NULL
! 40: string(%d) "%stest_unset.phar.php"
! 41: bool(false)
! 42: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>