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