xref: /PHP-8.1/ext/phar/tests/033.phpt (revision 74859783)
1--TEST--
2Phar::chmod
3--EXTENSIONS--
4phar
5--INI--
6phar.readonly=0
7phar.require_hash=0
8--FILE--
9<?php
10$fname = __DIR__ . '/' . 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--CLEAN--
34<?php
35unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.1.phar.php');
36?>
37--EXPECT--
38bool(false)
39bool(true)
40bool(false)
41test dir
42bool(true)
43bool(true)
44bool(false)
45bool(true)
46