xref: /PHP-7.4/ext/phar/tests/rename_dir.phpt (revision 26dfce7f)
1--TEST--
2Phar: rename_dir test
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 = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php';
12$pname = 'phar://' . $fname;
13$file = "<?php
14Phar::mapPhar('hio');
15__HALT_COMPILER(); ?>";
16
17$files = array();
18$files['a/x'] = 'a';
19include 'files/phar_test.inc';
20include $fname;
21
22echo file_get_contents($pname . '/a/x') . "\n";
23rename($pname . '/a', $pname . '/b');
24echo file_get_contents($pname . '/b/x') . "\n";
25echo file_get_contents($pname . '/a/x') . "\n";
26?>
27--CLEAN--
28<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
29--EXPECTF--
30a
31a
32
33Warning: file_get_contents(phar://%srename_dir.phar.php/a/x): failed to open stream: phar error: "a/x" is not a file in phar "%srename_dir.phar.php" in %srename_dir.php on line %d
34