xref: /PHP-8.1/ext/phar/tests/rename.phpt (revision 74859783)
1--TEST--
2Phar: rename test
3--EXTENSIONS--
4phar
5--INI--
6phar.readonly=0
7phar.require_hash=0
8--FILE--
9<?php
10$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php';
11$pname = 'phar://' . $fname;
12$file = "<?php
13Phar::mapPhar('hio');
14__HALT_COMPILER(); ?>";
15
16$files = array();
17$files['a'] = 'a';
18include 'files/phar_test.inc';
19include $fname;
20
21echo file_get_contents($pname . '/a') . "\n";
22rename($pname . '/a', $pname . '/b');
23echo file_get_contents($pname . '/b') . "\n";
24echo file_get_contents($pname . '/a') . "\n";
25?>
26--CLEAN--
27<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
28--EXPECTF--
29a
30a
31
32Warning: file_get_contents(phar://%srename.phar.php/a): Failed to open stream: phar error: "a" is not a file in phar "%srename.phar.php" in %srename.php on line %d
33