xref: /php-src/ext/phar/tests/tar/phar_setalias.phpt (revision 98d004c9)
1--TEST--
2Phar::setAlias() tar-based
3--EXTENSIONS--
4phar
5--INI--
6phar.require_hash=0
7phar.readonly=0
8--FILE--
9<?php
10
11$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.tar';
12$fname2 = __DIR__ . '/' . basename(__FILE__, '.php') . '.copy.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--CLEAN--
41<?php
42unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar');
43unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.copy.phar.tar');
44?>
45--EXPECT--
46hio
47test
48test
49