Annotation of embedaddon/php/ext/phar/tests/phar_convert_tar.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Phar::convertToTar()
3: --SKIPIF--
4: <?php if (!extension_loaded("phar")) die("skip"); ?>
5: --INI--
6: phar.require_hash=0
7: phar.readonly=0
8: --FILE--
9: <?php
10:
11: $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar';
12: $pname = 'phar://' . $fname;
13: $fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar';
14: $fname3 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.phar.tar';
15: $stub = '<?php echo "first stub\n"; __HALT_COMPILER(); ?>';
16: $file = $stub;
17:
18: $files = array();
19: $files['a'] = 'a';
20: $files['b'] = 'b';
21: $files['c'] = 'c';
22:
23: include 'files/phar_test.inc';
24:
25: $phar = new Phar($fname);
26: var_dump($phar->isFileFormat(Phar::TAR));
27: var_dump($phar->getStub());
28:
29: $phar = $phar->convertToExecutable(Phar::TAR);
30: var_dump($phar->isFileFormat(Phar::TAR));
31: var_dump($phar->getStub());
32:
33: copy($fname2, $fname3);
34:
35: $phar = new Phar($fname3);
36: var_dump($phar->isFileFormat(Phar::TAR));
37: var_dump($phar->getStub());
38:
39: ?>
40: ===DONE===
41: --CLEAN--
42: <?php
43: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar');
44: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar');
45: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.2.phar.tar');
46: __HALT_COMPILER();
47: ?>
48: --EXPECT--
49: bool(false)
50: string(48) "<?php echo "first stub\n"; __HALT_COMPILER(); ?>"
51: bool(true)
52: string(60) "<?php // tar-based phar archive stub file
53: __HALT_COMPILER();"
54: bool(true)
55: string(60) "<?php // tar-based phar archive stub file
56: __HALT_COMPILER();"
57: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>