xref: /PHP-7.1/ext/phar/tests/033.phpt (revision 7af945e2)
1--TEST--
2Phar::chmod
3--SKIPIF--
4<?php if (!extension_loaded("phar")) die("skip"); ?>
5--INI--
6phar.readonly=0
7phar.require_hash=0
8--FILE--
9<?php
10$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.1.phar.php';
11$pname = 'phar://hio';
12$file = '<?php include "' . $pname . '/a.php"; __HALT_COMPILER(); ?>';
13
14$files = array();
15$files['a.php']   = '<?php echo "This is a\n"; include "'.$pname.'/b.php"; ?>';
16$files['dir/'] = '';
17$hasdir = 1;
18include 'files/phar_test.inc';
19$a = new Phar($fname);
20var_dump($a['a.php']->isExecutable());
21$a['a.php']->chmod(0777);
22var_dump($a['a.php']->isExecutable());
23$a['a.php']->chmod(0666);
24var_dump($a['a.php']->isExecutable());
25echo "test dir\n";
26var_dump($a['dir']->isDir());
27var_dump($a['dir']->isReadable());
28$a['dir']->chmod(000);
29var_dump($a['dir']->isReadable());
30$a['dir']->chmod(0666);
31var_dump($a['dir']->isReadable());
32?>
33===DONE===
34--CLEAN--
35<?php
36unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.1.phar.php');
37?>
38--EXPECT--
39bool(false)
40bool(true)
41bool(false)
42test dir
43bool(true)
44bool(true)
45bool(false)
46bool(true)
47===DONE===
48