Annotation of embedaddon/php/ext/phar/tests/tar/rmdir.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Phar: rmdir test tar-based
! 3: --SKIPIF--
! 4: <?php if (!extension_loaded("phar")) die("skip"); ?>
! 5: --INI--
! 6: phar.readonly=0
! 7: phar.require_hash=0
! 8: --FILE--
! 9: <?php
! 10: include dirname(__FILE__) . '/files/tarmaker.php.inc';
! 11: $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar';
! 12: $alias = 'phar://' . $fname;
! 13:
! 14: $tar = new tarmaker($fname, 'none');
! 15: $tar->init();
! 16: $tar->addFile('.phar/stub.php', "<?php
! 17: Phar::mapPhar('hio');
! 18: __HALT_COMPILER(); ?>");
! 19:
! 20: $files = array();
! 21: $files['a/x'] = 'a';
! 22:
! 23: foreach ($files as $n => $file) {
! 24: $tar->addFile($n, $file);
! 25: }
! 26: $tar->mkdir('a');
! 27:
! 28: $tar->close();
! 29:
! 30: include $fname;
! 31:
! 32: echo file_get_contents($alias . '/a/x') . "\n";
! 33: var_dump(rmdir($alias . '/a'));
! 34: echo file_get_contents($alias . '/a/x') . "\n";
! 35: unlink($alias . '/a/x');
! 36: var_dump(rmdir($alias . '/a'));
! 37: ?>
! 38: --CLEAN--
! 39: <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?>
! 40: --EXPECTF--
! 41: a
! 42:
! 43: Warning: rmdir(): phar error: Directory not empty in %srmdir.php on line %d
! 44: bool(false)
! 45: a
! 46: bool(true)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>