xref: /PHP-5.6/ext/phar/tests/tar/phar_setalias.phpt (revision 16b4d8e0)
1--TEST--
2Phar::setAlias() tar-based
3--SKIPIF--
4<?php if (!extension_loaded("phar")) die("skip"); ?>
5--INI--
6phar.require_hash=0
7phar.readonly=0
8--FILE--
9<?php
10
11$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar';
12$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '2.phar.tar';
13
14$phar = new Phar($fname);
15$phar->setStub('<?php echo "first stub\n"; __HALT_COMPILER(); ?>');
16$phar->setAlias('hio');
17
18$files = array();
19
20$files['a'] = 'a';
21$files['b'] = 'b';
22$files['c'] = 'c';
23
24foreach ($files as $n => $file) {
25	$phar[$n] = $file;
26}
27
28$phar->stopBuffering();
29
30echo $phar->getAlias() . "\n";
31$phar->setAlias('test');
32echo $phar->getAlias() . "\n";
33
34copy($fname, $fname2);
35$phar->setAlias('unused');
36$a = new Phar($fname2);
37echo $a->getAlias() . "\n";
38
39?>
40===DONE===
41--CLEAN--
42<?php
43unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar');
44unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phartmp.tar');
45__HALT_COMPILER();
46?>
47--EXPECT--
48hio
49test
50test
51===DONE===
52