summaryrefslogtreecommitdiff
path: root/ext/phar/tests/zip/rename_dir.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/phar/tests/zip/rename_dir.phpt')
-rw-r--r--ext/phar/tests/zip/rename_dir.phpt34
1 files changed, 34 insertions, 0 deletions
diff --git a/ext/phar/tests/zip/rename_dir.phpt b/ext/phar/tests/zip/rename_dir.phpt
new file mode 100644
index 0000000000..bb03c7fd66
--- /dev/null
+++ b/ext/phar/tests/zip/rename_dir.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Phar: rename_dir test zip-based
+--SKIPIF--
+<?php if (!extension_loaded("phar")) die("skip"); ?>
+--INI--
+phar.readonly=0
+phar.require_hash=0
+--FILE--
+<?php
+
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.zip';
+$alias = 'phar://' . $fname;
+
+$phar = new Phar($fname);
+$phar->setStub("<?php
+Phar::mapPhar('hio');
+__HALT_COMPILER(); ?>");
+$phar['a/x'] = 'a';
+$phar->stopBuffering();
+
+include $fname;
+
+echo file_get_contents($alias . '/a/x') . "\n";
+rename($alias . '/a', $alias . '/b');
+echo file_get_contents($alias . '/b/x') . "\n";
+echo file_get_contents($alias . '/a/x') . "\n";
+?>
+--CLEAN--
+<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.zip'); ?>
+--EXPECTF--
+a
+a
+
+Warning: file_get_contents(phar://%srename_dir.phar.zip/a/x): failed to open stream: phar error: "a/x" is not a file in phar "%srename_dir.phar.zip" in %srename_dir.php on line %d \ No newline at end of file