xref: /PHP-5.3/ext/phar/tests/tar/033.phpt (revision 16b4d8e0)
1--TEST--
2Phar::chmod tar-based
3--SKIPIF--
4<?php if (!extension_loaded("phar")) die("skip"); ?>
5--INI--
6phar.readonly=0
7phar.require_hash=0
8--FILE--
9<?php
10
11$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar';
12$alias = 'phar://hio';
13
14$phar = new Phar($fname);
15$phar['a.php'] = '<?php echo "This is a\n"; include "'.$alias.'/b.php"; ?>';
16$phar->setAlias('hio');
17$phar->addEmptyDir('test');
18$phar->stopBuffering();
19
20try {
21	var_dump($phar['a.php']->isExecutable());
22	$phar['a.php']->chmod(0777);
23	var_dump($phar['a.php']->isExecutable());
24	$phar['a.php']->chmod(0666);
25	var_dump($phar['a.php']->isExecutable());
26	echo "test dir\n";
27	var_dump($phar['test']->isReadable());
28	$phar['test']->chmod(0000);
29	var_dump($phar['test']->isReadable());
30	$phar['test']->chmod(0666);
31	var_dump($phar['test']->isReadable());
32} catch (Exception $e) {
33	echo $e->getMessage() . "\n";
34}
35
36?>
37===DONE===
38--CLEAN--
39<?php
40unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar');
41?>
42--EXPECTF--
43bool(false)
44bool(true)
45bool(false)
46test dir
47bool(true)
48bool(false)
49bool(true)
50===DONE===
51