Annotation of embedaddon/php/ext/phar/tests/tar/all.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Phar: test that creation of tar-based phar generates valid tar with all bells/whistles
3: --SKIPIF--
4: <?php
5: if (!extension_loaded("phar")) die("skip");
6: if (version_compare(PHP_VERSION, "6.0", ">")) die("skip pre-unicode version of PHP required");
7: if (!extension_loaded("spl")) die("skip SPL not available");
8: if (!extension_loaded("zlib")) die("skip zlib not available");
9: if (!extension_loaded("bz2")) die("skip bz2 not available");
10: ?>
11: --INI--
12: phar.readonly=0
13: --FILE--
14: <?php
15:
16: $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar.php';
17: $pname = 'phar://' . $fname;
18: $fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.phar.tar.php';
19: $pname2 = 'phar://' . $fname2;
20:
21: $phar = new Phar($fname);
22:
23: $phar->setMetadata('hi there');
24: $phar['a'] = 'hi';
25: $phar['a']->setMetadata('a meta');
26: $phar['b'] = 'hi2';
27: $phar['c'] = 'hi3';
28: $phar['b']->chmod(0444);
29: $phar->setStub("<?php ok __HALT_COMPILER();");
30: $phar->setAlias("hime");
31: unset($phar);
32: copy($fname, $fname2);
33: Phar::unlinkArchive($fname);
34: var_dump(file_exists($fname), file_exists($pname . '/a'));
35:
36: $phar = new Phar($fname2);
37: var_dump($phar['a']->getContent(), $phar['b']->getContent(), $phar['c']->getContent());
38: var_dump((string) decoct(fileperms($pname2 . '/b')));
39: var_dump($phar->getStub());
40: var_dump($phar->getAlias());
41: var_dump($phar->getMetadata());
42: var_dump($phar['a']->getMetadata());
43: ?>
44: ===DONE===
45: --CLEAN--
46: <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.2.phar.tar.php'); ?>
47: --EXPECT--
48: bool(false)
49: bool(false)
50: string(2) "hi"
51: string(3) "hi2"
52: string(3) "hi3"
53: string(6) "100444"
54: string(32) "<?php ok __HALT_COMPILER(); ?>
55: "
56: string(4) "hime"
57: string(8) "hi there"
58: string(6) "a meta"
59: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>