Annotation of embedaddon/php/ext/phar/tests/alias_acrobatics.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Phar: alias edge cases
3: --SKIPIF--
4: <?php if (!extension_loaded("phar")) die("skip"); ?>
5: --INI--
6: phar.readonly=0
7: --FILE--
8: <?php
9:
10: $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar';
11: $fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.phar';
12:
13: $p = new Phar($fname);
14:
15: $p->setAlias('foo');
16: $p['unused'] = 'hi';
17: try {
18: $a = new Phar($fname2, 0, 'foo');
19: } catch (Exception $e) {
20: echo $e->getMessage(),"\n";
21: }
22: copy($fname, $fname2);
23: echo "2\n";
24: try {
25: $a = new Phar($fname2);
26: } catch (Exception $e) {
27: echo $e->getMessage(),"\n";
28: }
29: try {
30: $b = new Phar($fname, 0, 'another');
31: } catch (Exception $e) {
32: echo $e->getMessage(),"\n";
33: }
34: ?>
35: ===DONE===
36: --CLEAN--
37: <?php
38: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar');
39: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.2.phar');
40: ?>
41: --EXPECTF--
42: alias "foo" is already used for archive "%salias_acrobatics.phar" cannot be overloaded with "%salias_acrobatics.2.phar"
43: 2
44: Cannot open archive "%salias_acrobatics.2.phar", alias is already in use by existing archive
45: alias "another" is already used for archive "%salias_acrobatics.phar" cannot be overloaded with "%salias_acrobatics.phar"
46: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>