summaryrefslogtreecommitdiff
path: root/ext/phar/tests/pharfileinfo_chmod.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/phar/tests/pharfileinfo_chmod.phpt')
-rw-r--r--ext/phar/tests/pharfileinfo_chmod.phpt33
1 files changed, 33 insertions, 0 deletions
diff --git a/ext/phar/tests/pharfileinfo_chmod.phpt b/ext/phar/tests/pharfileinfo_chmod.phpt
new file mode 100644
index 0000000000..e99be5d6b9
--- /dev/null
+++ b/ext/phar/tests/pharfileinfo_chmod.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Phar: PharFileInfo::chmod extra code coverage
+--SKIPIF--
+<?php if (!extension_loaded("phar")) die("skip"); ?>
+--INI--
+phar.readonly=0
+--FILE--
+<?php
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar';
+$pname = 'phar://' . $fname;
+
+$phar = new Phar($fname);
+
+$phar['a/b'] = 'hi there';
+
+$b = $phar['a/b'];
+try {
+$phar['a']->chmod(066);
+} catch (Exception $e) {
+echo $e->getMessage(), "\n";
+}
+$b->chmod(array());
+lstat($pname . '/a/b'); // sets BG(CurrentLStatFile)
+$b->chmod(0666);
+?>
+===DONE===
+--CLEAN--
+<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar'); ?>
+--EXPECTF--
+Phar entry "a" is a temporary directory (not an actual entry in the archive), cannot chmod
+
+Warning: PharFileInfo::chmod() expects parameter 1 to be long, array given in %spharfileinfo_chmod.php on line %d
+===DONE=== \ No newline at end of file