Annotation of embedaddon/php/ext/phar/tests/phar_oo_iswriteable.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Phar::isWriteable
! 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: $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.1.phar.php';
! 11: $fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.tar';
! 12: $pname = 'phar://hio';
! 13: $file = '<?php include "' . $pname . '/a.php"; __HALT_COMPILER(); ?>';
! 14:
! 15: $files = array();
! 16: $files['a.php'] = '<?php echo "This is a\n"; include "'.$pname.'/b.php"; ?>';
! 17: $files['dir/'] = '';
! 18: $hasdir = 1;
! 19: include 'files/phar_test.inc';
! 20: $a = new Phar($fname);
! 21: $b = new PharData($fname2);
! 22: $b['test'] = 'hi';
! 23:
! 24: var_dump($a['a.php']->isWritable());
! 25: var_dump($a['a.php']->isReadable());
! 26: $a['a.php']->chmod(000);
! 27: var_dump($a['a.php']->isWritable());
! 28: var_dump($a['a.php']->isReadable());
! 29: $a['a.php']->chmod(0666);
! 30: var_dump($a['a.php']->isWritable());
! 31: var_dump($a['a.php']->isReadable());
! 32: ini_set('phar.readonly',1);
! 33: clearstatcache();
! 34: var_dump($a['a.php']->isWritable());
! 35: var_dump($a['a.php']->isReadable());
! 36: ini_set('phar.readonly',0);
! 37: clearstatcache();
! 38: var_dump($a['a.php']->isWritable());
! 39: var_dump($a['a.php']->isReadable());
! 40: ?>
! 41: archive
! 42: <?php
! 43: ini_set('phar.readonly',0);
! 44: $p = new Phar('doesnotexisthere.phar');
! 45: var_dump($p->isWritable());
! 46: clearstatcache();
! 47: var_dump($a->isWritable());
! 48: var_dump($b->isWritable());
! 49: ini_set('phar.readonly',1);
! 50: clearstatcache();
! 51: var_dump($a->isWritable());
! 52: var_dump($b->isWritable());
! 53: chmod($fname2, 000);
! 54: clearstatcache();
! 55: var_dump($a->isWritable());
! 56: var_dump($b->isWritable());
! 57: chmod($fname2, 0666);
! 58: ?>
! 59: ===DONE===
! 60: --CLEAN--
! 61: <?php
! 62: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.1.phar.php');
! 63: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.tar');
! 64: ?>
! 65: --EXPECT--
! 66: bool(true)
! 67: bool(true)
! 68: bool(false)
! 69: bool(false)
! 70: bool(true)
! 71: bool(true)
! 72: bool(false)
! 73: bool(true)
! 74: bool(true)
! 75: bool(true)
! 76: archive
! 77: bool(true)
! 78: bool(true)
! 79: bool(true)
! 80: bool(false)
! 81: bool(true)
! 82: bool(false)
! 83: bool(false)
! 84: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>